Using a Java IDE
Using a Java IDE with leJOS NXJ


Eclipse is a pretty powerful Java IDE. At the moment, this is the IDE that is supported the best by leJOS. The leJOS plug-in for Eclipse is pretty mature. Please read our tutorial page on how to use Eclipse with leJOS.

Neatbeans and other Java IDEs

Besides Eclipse, there are many other Java IDEs. Most of them will probably offer support for Ant and it recommended to compile and run your programs using Ant build scripts. We provide Ant build scripts as part of your sample and example projects. The example projects are a good starting point for structuring your own project and their Ant files build.xml and are a good template for your own project's Ant build scripts.

However, most of the IDEs we are aware of are based on the assumption, that a fully fledged Java Runtime is used. For those Java programs that run on the NXT, leJOS provides a re-implementation of a Java Runtime in form of the file classes.jar. But the leJOS Java Runtime only implements a subset of the standard Java Runtime. Also, some classes in the leJOS Java Runtime have additional methods that would not exist in a standard Java Runtime. Therefore, even after configuring your IDE by adding the classes.jar to the classpath of your project, the IDE might claim during the editing of your Java source code that some methods (e.g. do not exist, even though the project compiles fine using Ant. Also, during auto-completion, the IDE may suggest classes or methods that actually do not exist in the leJOS Java Runtime which might result in unexpected errors during the compilation process.

Hence it is recommended to use Eclipse, which is probably the best choice at the moment, as far as leJOS support is concerned.

Java programs that run on the PC and remote control the NXT Brick via USB or Bluetooth should be possible with most IDEs without problems. The IDE should be configured to include the JAR files from lib/pc directory of the leJOS distribution in the classpath. classes.jar must not be included in the project's classpath.

Back to top