Developing ImageJ in Eclipse
Template:DevelopmentThis article explains how to install and configure Eclipse to develop ImageJ components and plugins. Directions correspond to Eclipse 4.4 Luna, and may need adjustment for other versions.
Install and configure Eclipse
Install the Java Development Kit
- Download and install the Java Development Kit (JDK) from the Java web site.
- Download "Eclipse IDE for Java Developers" from the Eclipse web site.
- Unpack the archive to a location of your choice.
Configure Eclipse for your platform
Avoid permissions issues. We recommend installing Eclipse outside of the
Configure Eclipse. After installing Eclipse, you will need to configure it to know about your JDK.
Use Wordpad to edit the
Now update Eclipse's JRE to be JDK-aware:
Understand Java 6 vs. Java 8. Eclipse should work on OS X with no further configuration. However, we recommend reading the OS X section of the FAQ, as there are several Java-related issues on OS X.
Avoid permissions issues. We recommend installing to
Do not use a package manager. For several reasons, we do not recommend installing Eclipse from a package manager. You may not get a new enough version of Eclipse (we recommend 4.3+), you will not get the Java Developers version that includes the M2E plugins, and you will likely have trouble installing additional plugins due to the permissions issues with the system-wide installation.
Clone the source code
Import the source code
- Choose from the Eclipse menu ›
- Select "Existing Maven Projects" and click Next
- Browse to the folder where you cloned the project source code
- Click Finish
Eclipse will import and automatically build the project(s). There should not be any build errors, but it is normal to see a large number (often hundreds) of warnings. These mostly come from Java-1.4-style code or unnecessary imports, variables or methods in the sources of authors who do not use an IDE and thus have no automatic assistance at cleaning up. All these warnings can be ignored, having no effect on the functionality of the code.
If you cloned the imagej project, you can launch the program as follows:
- In the Package Explorer, expand the
- Navigate into
- Navigate into
- Right-click on
- Choose "Run As" and then "Java Application"
Other projects will have different main classes.