What is the best way to run Java code on the RP? Does installing the OpenJDK from the Debian/Fedora repos work OK? Are there tweaks one should use for improved performance? Also, is there a "light weight" JVM available for the RP which runs better/faster than the standard JVM from OpenJDK? If so, how is this obtained and installed?


7 Answers 7


For the "lightweight" part of your question, there are a number of smaller JVMs that you might want to consider.

For instance JamVM was originally designed to work in small systems like the RP and both it and Cacao (another smaller JVM) are available as packages in debian:


though both use the open-jdk class libraries AFAIK, and its the class libraries that are the huge part (disk footprint wise) of installing a JRE.


Installing from the repositories should work fine on Debian:

sudo apt-get clean
sudo apt-get update
sudo apt-get install openjdk-6-jre

Java doesn't seem to be available on the Arch repo.

Can someone please edit with information for Fedora, I have no knowledge of that distro.


There's no special lightweight JDK that I know of, but the normal openjdk from the repo seems to work ok-ish for me.

I say ok-ish - there's no problem with functionality per-se, at least none that I've found. That includes headful applications, Swing / AWT also seems to work well (haven't tried JavaFX.) Performance on the other hand isn't anything to right home about due to a lack of JIT (see this question.)


I've seen a lot of interest in running various cut down JVMs running on raspberry pi but few people have looked into compiling java straight to machine code. http://gcc.gnu.org/java/ hosts a compiler that can give you machine code from java or from java byte code. The project that I was going to get to use gcj for ended up being scrapped before it got off the ground but the compiler is billed as a good fit for embedded systems so it should suit the raspberry pi just fine.

Half way down the page in this forum there is a very nice graph somebody made comparing the relative performance of various JVMs as well as gcj http://www.raspberrypi.org/phpBB3/viewtopic.php?t=6330&p=124107. Keep in mind these benchmarks were made before the drastic performance increase included in the latest raspbian distro.

  • Now, six months later, do you have hands-on experience with doing this on the Raspberry? Dec 28, 2012 at 11:20

Oracle has graciously ported a version of Java 7 SE headless to the ARM for the Raspberry PI. I copied over class files from some of my non-EE console based code and it runs fine - but about 9 times slower than a Pentium IV at 3GHz. see http://eclipsejpa.blogspot.ca/2012/10/java-se-7-embedded-on-raspberry-pi.html



Oracle released Java 8 (and Java 7) for ARM. Use the Link from this Page to get the currently best Java version for your Raspberry Pi.

This should also work:

sudo apt-get update
sudo apt-get install oracle-java8-jdk

I don't how it works with a JVM, but I know the ARM SoC on the Raspberry Pi can run the Java bytecode itself.

I don't have the Raspberry Pi to test JRE. So I speculate.

Use: cat /proc/cpuinfo/ and see if java could support the Raspberry Pi.

  • 1
    This java flag in /proc/cpuinfo means that the CPU support Jazelle extension. You can read about this on wikipedia. Oct 5, 2012 at 12:27
  • The problem with Jazelle is that none of the open source JVMs can use it. Oct 6, 2012 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.