LeJOS is a Java based replacement firmware (OS) for Lego Mindstorms, replaces the rather nasty GUI drag & drop "programming language" that comes with the Lego Robotics Invention System.
After installing the LeJOS firmware, can you create Java programs in your usual way. Then you'll compile the with the leJOS compiler. This compiler is really just the normal "javac" compiler, but with a wrapper that specifies different base classes (replacements for classes like System as well as additional classes like Motor). You then upload the compiled program to the RCX and run it there.