A Groovy Way to Start Programming - Getting Started With Scriptom in NetBeans 6
Scriptom + Netbeans Quickstart Guide
Needed: (Download all of these before beginning)
Instructions:
Needed: (Download all of these before beginning)
- [download] [site] Netbeans-Java 6.0 Development (with Groovy support) ~50MB
- [download] [site] Groovy 1.1 or higher (zip file) ~20MB
- [download] [site] Scriptom 1.5 or higher ~3MB
- [download] [site] Jacob 1.14 or higher ~0.5MB
Instructions:
- Download all files above.
- Extract Netbeans-Java to Deskop in a folder called "netbeans"
- Inside this folder (where LISCENSE.TXT is), create a new folder "lib".
- Extract Groovy 1.X/embeddable/groovy-all-1.x.jar to Desktop\netbeans\lib. (the "lib" folder you just created)
- Open Scriptom-2.x.zip and extract Scriptom-2.X.jar to Desktop\netbeans\lib.
- Open jacob_1.x.zip and extract jacob.jar to Desktop\netbeans\lib. (When prompted to overwrite, click YES)
- Extract jacob.dll to Desktop. (Most people can use the version in the x86 folder)
- Navigate to Desktop\netbeans\bin, and right click netbeans.exe >> Send To >> Desktop.
- Close out all open windows.
- Open Netbeans by clicking the shortcut we just created.
(It will take about 3 minutes. If you've tried installing the Groovy module befor and recieve errors, click "disable and continue", then remove Groovy from Tools >> Plugins, restart Netbeans, then Continue) - In Netbeans, go to Tools >> Plugins >> and wait for the plugin listing to show up. If there are only 20 or so plugins, try to refresh it.
- In the search bar, type "groovy", and check it in the list, then click the install button.
(This will install Groovy scripting support in Netbeans)
*Note: If you have special proxy settings, Netbeans can be configured to use them, but it should work fine with your computer's default settings. - Once its finished downloading and installing, it will prompt you to restart your IDE Click Yes (Restart Netbeans).
- Make a new Groovy project by navigating to File >> New Project >> Groovy Application. Give it a good name, like "GroovyTest". If you get some message dialogs, take defaults.
- Before we continue, the jacob.dll that was placed on the Desktop needs to be added to your PATH. Some people prefer to copy this to C:\Windows\System32. There are other locations that may work too, but I highly recommend placing jacob.dll it in the root of your project path, at My Documents\NetbeansProjects\GroovyTest.
*Note: The logic behind this is the programmer should keep track of required dlls on a per-project basis, because, in my opinion, Groovy, and Scriptom do a horrible job of maintaining file versions (If you don't believe me, see the last two day's articles) - OK, now we're ready to code!
- Lets open your new file by double-clicking on it in your Navigator. It should be called "Main", unless you gave it a different name.
- You should see Groovy already made some sample code. We can leave it there. Add this code to the bottom of it (taken from Scriptom-2.0.zip/examples/ie/IE.groovy):
[code]import org.codehaus.groovy.scriptom.*;
[/code]
Scriptom.inApartment
{
def ie = new ActiveXObject('InternetExplorer.Application')
ie.Visible = true
ie.AddressBar = true
ie.Navigate "http://www.google.com/search?&q=site%3Ablogspot.com+fatbuttlarry"
} - Save the file by clicking the Disk icon in the top left corner of the toolbar.
- Run the program by pressing the green "Play" button in the center of the toolbar.
- Clean up all downloaded files, leaving the Netbeans Shortcut and the Netbeans folder.
Comments