Downloading NetBeans and the ImageJ Source file
Setting Up ImageJ in NetBeans
- Download and install JDK 5.0 bundled with NetBeans 4.1 at the Sun Downloads page. Macintosh users should download NetBeans 4.1 for OS X from netbeans.org.
- Download the latest ImageJ source code from rsb.info.nih.gov/ij/download/src/
- Unzip the ImageJ source. The folder "source" in the directory where you unzip this file is the ImageJ source folder
Run NetBeans
Go to the File>New Project... dialogBuilding ImageJ with NetBeans
- Choose Project
- Select General and "Java Project with Existing Ant Script"
- Click "Next >"
- Name and Location
- Click "Browse..." next to the location text box.
- Select and choose the source folder where the ImageJ build.xml file is located. At this point, NetBeans will fill in the four text boxes with the appropriate entries.
- Click "Next >"
- Build and Run Actions
- Click "Next >"
- Source Package Folders
- Click "Add Folder..."
- Select and choose the folder "...source\ij"
- Click "Add Folder..."
- Select and choose the folder "...source\plugins"
- Click "Finish"
Compiling and Debugging Plugins
- Java 5.0 users, double click the build.xml file and delete the " target= "1.1"" at the end of line 9
- Go to the Build>Build Main Project (Ignore the red error messages in the ImageJ build output.)
- Go to the File> "ImageJ" Properties
- Select the Java Sources Classpath category
- Select ij[ij] in the as the Source Package Folder
- Click "Add JAR/Folder..."
- Select and choose the ij.jar file which NetBeans just built in the source directory
- Change the Source Package Folder to plugins[plugins]
- Click "Add JAR/Folder..."
- Select and choose the ij.jar file again
- Click "OK"
For a list of NetBeans debugging commands go the NetBeans Debugger page.
- Right click on the plugins folder and go to New>Java Class...
- Type in the name of your plugin
- Click "Finish"
- Write or paste your plugin into the Java Editor window.
- Go to Build>Compile "(The name of your plugin)"
- Click "Generate"
- In the ide-file-targets.xml file that was just created, change "${build.classes.dir}" to "plugins" in line 9
- Delete line 8 in the ide-file-targets.xml file
- Change line 12 in the build.xml file from <exclude name="plugins/*" /> to <!--exclude name="plugins/*" /-->
- Select your plugin from the ImageJ Project tree
- Go to Build>Compile "(The name of your plugin)"
- Go to Run>Debug Main Project
- Click "Set Output..."
- Click "OK"
- Go to Run>Debug Main Project
- Click "Generate"
- Go to Run>Debug Main Project (ImageJ will run. The plugin you created will be in the plugins menu)
- Go to Window>Debugging>Sources
- Check all the folders in the Sources tab
- Run you plugin from the ImageJ plugins menu. NetBeans will debug your plugin and stop at any specified breakpoints
For a more basic tutorial go to NetBeans Debugging Applications page.
More Tutorials
- Grant Harris at the Marine Biological Laboratory has written another ImageJ/NetBeans tutorial.
- Patrick Pirrotte has written a guide for Eclipse users.