Over a million developers have joined DZone.

Migrating from Java to Groovy with NetBeans IDE 6.7

· Java Zone

Microservices! They are everywhere, or at least, the term is. When should you use a microservice architecture? What factors should be considered when making that decision? Do the benefits outweigh the costs? Why is everyone so excited about them, anyway?  Brought to you in partnership with IBM.

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!

 

Discover how the Watson team is further developing SDKs in Java, Node.js, Python, iOS, and Android to access these services and make programming easy. Brought to you in partnership with IBM.

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}