What Is leJOS and How Do You Run Java on LEGO Mindstorms?

leJOS is a Java-based replacement firmware for LEGO Mindstorms controllers. Instead of programming the brick with LEGO's own firmware and tools, you flash leJOS onto the controller and run Java code directly on it. The project covers three generations of hardware: RCX (the original leJOS firmware), NXT (the NXJ firmware), and EV3 (the leJOS EV3 releases). If you want to write robot programs in Java, control motors and sensors through a Java API, and deploy compiled classes to the brick, leJOS is the path — but the exact steps differ by generation, so pick the section that matches your hardware.

Which platforms leJOS supports

Platform Firmware / name Notes from the project
RCX leJOS (original) Java-based replacement firmware for the RCX microcontroller
NXT NXJ Java-based replacement firmware for the NXT microcontroller
EV3 leJOS EV3 Separate release line (0.5.0-alpha through 0.9.1-beta)

The site describes leJOS as "a Java based replacement firmware for the Lego Mindstorms RCX microcontroller" and NXJ as "a Java based replacement firmware for the Lego Mindstorms NXT microcontroller." EV3 support is documented through its own Wiki and release announcements.

How Java actually runs on the brick

The brick does not run a desktop JVM. leJOS ships a small Java virtual machine (the project's TinyVM lineage) that executes on the microcontroller itself. Your workflow is therefore:

  1. Write Java source on your PC.
  2. Compile it against the leJOS API for your platform (NXJ API or EV3 API).
  3. Link and upload the resulting class files to the brick over the connection your platform uses.
  4. The on-brick VM runs the program, and your code calls the API to drive motors, read sensors, and use brick features.

Because the VM is small, you are working within embedded constraints rather than full Java SE — the API documentation for your platform is the authoritative list of what is available.

Getting started: EV3

EV3 is the most recently maintained line, and its releases are the clearest example of the update flow.

  1. Download a release. The site lists EV3 versions from 0.5.0-alpha up to 0.9.1-beta (Nov 16, 2015). Start from the Downloads page rather than an old forum link.
  2. Prepare the SD card. From the 0.8.0-alpha release onward, the project introduced an SD card installer. Earlier releases (0.6.0-alpha, 0.7.0-alpha) instructed you to create a new SD card from the download.
  3. Follow the Wiki instructions. Every release announcement points to the Wiki for installation steps — that is the maintained procedure, and it changes between versions.
  4. Set up Eclipse. The project provides a leJOS EV3 Eclipse plugin. The 0.9.1-beta announcement specifically tells existing users to update the plugin to the matching 0.9.1 version.
  5. Build and deploy your project. For the alpha releases, the update notes describe rebuilding DbusJava, ev3classes, and your own projects after switching versions.

A practical warning drawn from the release history: version mismatches are the common failure point. If you update the firmware but not the Eclipse plugin (or vice versa), expect build or deployment errors. Update both together.

Getting started: NXT (NXJ)

For NXT, the relevant entry points on the site are the leJOS NXJ API, the PC API, and the NXJ Tutorial. The pattern is the same as EV3 — install the replacement firmware, compile against the NXJ API, and upload to the brick — but use the NXT-specific tutorial and API docs rather than the EV3 ones. The PC API matters when your robot needs to talk to a program running on your computer rather than acting autonomously.

Getting started: RCX

RCX is the oldest supported platform. The site provides a leJOS RCX API and a Tutorial for it. Expect the oldest toolchain and the least active development of the three; use the RCX tutorial and API as your reference rather than trying to adapt EV3 instructions.

Where to find documentation

The site's navigation maps directly to what you need:

  • Wiki — installation and update instructions, referenced by every release announcement
  • Downloads — firmware releases per platform
  • API — leJOS NXJ API, PC API, leJOS RCX API, and EV3 API
  • Tutorial — per-platform getting-started guides
  • FAQ and Forum — troubleshooting and community answers
  • Blog — release announcements and project news

For EV3 specifically, the release announcements repeatedly direct existing users to the EV3 Software forum announcement, which is where upgrade caveats are posted.

Choosing your path

  • New to leJOS and buying hardware now: EV3 has the most recent releases and an Eclipse plugin, so it has the shortest path from download to running code.
  • Already own an NXT: use NXJ and the NXT tutorial; there is no reason to switch hardware just for leJOS.
  • Working with an RCX: leJOS supports it, but treat the RCX tutorial as the only reliable guide.
  • Need PC-side control: look at the PC API in addition to the on-brick API.

One more resource if you prefer learning from a book: the site notes an update to Maximum LEGO NXT: Building Robots with Java Brains, covering revised projects plus new ones including a laser sensor and beacon localization.

lejos.sourceforge.io
leJOS is a Java based replacement firmware for the Lego Mindstorms RCX microcontroller and NXJ is a Java based replacement firmware for the Lego Mind…