You will need NetBeans IDE 6.7.1 or 6.8 with Groovy Plugin to develop Groovy scripts. The Groovy support comes with NetBeans "Java" and "All" package. If your NetBeans does not have Groovy, download the plugin through NetBeans Plugin Manager. For more information about adding a new plugin, click IDE Basics > Plugins > Updating the IDE on the NetBeans Help menu.

Use the following three simple steps to develop and run a Groovy script in NetBeans:

  1. Set up a classpath.
  2. Develop a Groovy script.


To set up a classpath


  1. Click Tools > Libraries on the main menu. The Library Manager dialog will open.
  2. Click the New Library button. The New Library dialog will open.
  3. Specify a library name, for example, MD16.8. The Library Type must be Class Libraries.
  4. Click OK to close the New Library dialog.
  5. Select your new library in the Libraries tree.
  6. Click the Add JAR/Folder button and add all the JAR files in <modeling tool name>/lib.
  7. Repeat steps 2 to 6 to add the Groovy library that is in <modeling tool name>/plugins/com.nomagic.magicdraw.automaton/engines/groovy-2.0.1/embeddable/groovy-all-2.0.1.jar.
  8. Click OK to close the Library Manager dialog.


To develop a Groovy script


  1. Click File > New Project on the main menu to create a Java application project. The New Project dialog will open.
  2. Select Java in the Categories box and Java Application in the Projects box, and then click Next.
  3. Choose a project location. Be sure that you do not select Create Main Class.
  4. Click Finish.
  5. Expand your project node in the Project window. The Libraries node will appear.
  6. Right-click the Libraries node and select Add Library from the shortcut menu.
  7. Click File > New File on the main menu to add a new Groovy file.
  8. Select Groovy in the Categories box and Groovy Script in the File Types box.
  9. Follow the instructions until finish.