Migrating from Java to Groovy with NetBeans IDE 6.7

One small enhancement in the upcoming NetBeans IDE 6.7 release is brand new built-in support for changing file extensions of existing files. That was never possible before.

Being able to change the extension of a file is pretty useful when you're converting a Java source file to a Groovy source file. The editability of the file extension that you see below is only available from 6.7 onwards (click to enlarge):

After changing the file extension, you simply need to specify in the Java application's Project Properties dialog that you're working with Groovy. By selecting the checkbox shown below, the Groovy JAR is added to the application classpath and the build.xml is changed so that the Groovy code and the Java code compile correctly (click to enlarge):

And then... you can begin weeding out all the superfluous Java code from your Groovy source file, paring it down to Groovy minimalism and then beefing it up to benefit from Groovy's syntactic sugar and its many other innovations!

 

AttachmentSize
fig-1.png87.23 KB
fig-1-smaller.png58.49 KB
fig-2.png62.97 KB
fig-2-smaller.png40.03 KB
0

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)