What Is the LEGO Mindstorms RCX and How Does leJOS Run Java on It?
The LEGO Mindstorms RCX is the first-generation programmable brick in the Mindstorms line, and leJOS is a Java-based replacement firmware that lets you run Java programs on it instead of the stock firmware. You'd choose this route if you already own an RCX and want to program it in Java rather than the original RCX code or third-party alternatives. The leJOS project site (lejos.sourceforge.io) documents a dedicated RCX API, tutorial, and downloads section alongside its later NXJ and EV3 work.
What the RCX is
The RCX is the programmable controller at the center of the original Mindstorms Robotics Invention System. It runs a small on-board runtime, accepts programs downloaded from a PC, and drives motors and reads sensors through its input and output ports. It predates the NXT and EV3 bricks, so it has less memory, a slower processor, and simpler sensor support than later hardware.
How leJOS replaces the RCX firmware
The site describes leJOS as "a Java based replacement firmware for the Lego Mindstorms RCX microcontroller," with NXJ as the equivalent for the NXT. In practice this means:
- You replace the firmware LEGO shipped on the brick with the leJOS firmware.
- That firmware hosts a small Java runtime (the project's TinyVM lineage) on the brick.
- You write Java on a PC, compile it, and upload the resulting program to the RCX, where the runtime executes it.
So the RCX stops running its original firmware and starts running Java bytecode under leJOS. The brick's own hardware limits — memory and CPU — still apply, which is why leJOS programs for the RCX are small and avoid heavy libraries.
Writing Java for the RCX
leJOS provides an RCX-specific API rather than the NXT or EV3 APIs. The site's navigation lists separate leJOS RCX API, Tutorial, and Downloads pages, which is where you find the classes for motors, sensors, and brick control, plus worked examples. The NXJ and EV3 sections are separate products with their own APIs, so code written for one brick does not carry over unchanged.
Getting started: install firmware, then upload a program
The exact menu names and tool versions live on the leJOS RCX tutorial and download pages; the general sequence is:
- Check prerequisites — an RCX brick, the means to connect it to your PC (the RCX's IR link), and a Java development setup on the PC.
- Download the leJOS RCX package from the Downloads section of the site.
- Install the leJOS firmware onto the RCX, replacing the stock firmware, following the tutorial's steps.
- Write and compile a small Java program against the RCX API.
- Upload the program to the brick over the same connection and run it.
- Verify by watching the brick's motors or sensors respond as your program directs; if nothing happens, re-check the firmware install and the upload step first.
Limitations to expect
Because the RCX is the oldest Mindstorms brick, leJOS on it is constrained compared with NXJ on the NXT or leJOS EV3 on the EV3. Expect tighter memory, a slower processor, and a smaller API surface. The site's own release notes show the project's active development moved on to EV3 (0.9.1-beta in 2015) and NXT, so RCX material is best treated as legacy support. If you are choosing hardware now rather than working with an existing RCX, the NXT and EV3 paths have more current documentation and tooling.