Free Tutorial 4 All


RESOURCES

Compiling and Running Groovy Scripts Step 5

Posted by admin | Photoshop | Wednesday 29 July 2009 9:15 am

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)

[Post to Twitter] Tweet This Post  [Post to Plurk] Plurk This Post  [Post to Yahoo Buzz] Buzz This Post  [Post to Delicious] Delicious This Post  [Post to Digg] Digg This Post  [Post to Ping.fm] Ping This Post  [Post to Reddit] Reddit This Post  [Post to StumbleUpon] Stumble This Post 

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

atriumax wordpress theme