WARNING: This documentation refers to an outdated version of rosjava and is probably incorrect. Use at your own risk.
Using rosjava with Eclipse
Please read the rosjava build overview first. You will first need to get your package built using the normal ROS tools to bootstrap basic project configuration. Afterwards, you can switch to using Eclipse to manage your project.
rosjava comes with scripts that will automatically generate the Java build path that Eclipse needs. These scripts will look at your ROS packages' dependencies to determine:
- jar files it should include from these dependencies
- msg files that should be compiled into jars
- srv files that should be compiled into jars
All of this is done using the normal ROS <depend package="foo" /> dependency mechanism in the manifest.xml file.
To generate the Eclipse .project/.classpath files simply:
This will generate the generate Eclipse .project and .classpath files if they are not already present. If you wish to replace an existing file, you must first delete it, then run rosmake.
The .classpath generation is similar to the ant build integration but includes some extra paths:
rosjava-src exports for the package are added as source directories
rosjava-pathelement exports for the package are added if built=true is not set.
The ant integration does not include these paths with ros.classpath as it is assumed that build.xml maintainers will wish to use standard Ant mechanisms for configuring local resources.
TODO/NOTE: this .project generation does not currently support adding and Android project nature.
Setting up your Eclipse project
Once you have generated .classpath/.project files, you can use the normal Eclipse 'import' mechanism to create an Eclipse project:
File -> Import -> Existing Projects into Workspace -> root directory: <your package directory>
From there a convenient way to do your builds from inside eclipse is to include the 'Ant' view to your java perspective and add your build.xml to the view. Note that this needs eclipse indigo to work (needs the latest release of the ant plugin to work on ros style build.xml's).
It's also possible to debug your nodes by creating a debug configuration with org.ros.RosRun as the main class, and your Node class (fully qualified name) as program argument.