Compiling and Running Groovy Scripts Step 5
You are going to want to get familiar with some tools Groovy has outside of Eclipse. You should set your environmental variable to point to Groovy. Open up your environmental variables tab and add a variable called GROOVY_HOME where the value will be something like this: C:\groovy-1.6-RC-3.
One thing about groovy is that is allows you to run the groovy scripts right away without creating a class. You can do this by opening the groovy console. Open a command prompt and type c:\groovysh. When the shell opens, you can type something like this groovy:000> println “Hello World” and that string will print to the console. The disadvantage of the shell is that when you close it, your data is gone.
You can create a groovy script very easily. Create a file called hello.groovy and in the text file, add this line of code: println “Hello World”. Save the file and from a regular command prompt (not the groovysh console) type: C:\groovy hello.groovy. You should see “Hello World” print to the console. This can be very helpful because you don’t have to create a class to compile some groovy code.
To compile the class you can type groovyc hello.groovy. This command will create a class for you.
(Step 6 coming soon)
Tweet This Post
Plurk This Post
Buzz This Post
Delicious This Post
Digg This Post
Ping This Post
Reddit This Post
Stumble This Post
No Comments »
No comments yet.
RSS feed for comments on this post.