RPi Java

General tips
Some general tips about Java perfomace on Raspberry Pi.

System memory
Java loves memory. If you do not plan to use desktop enviroment / XBMC run  select memory_split and decrease GPU memory to 16. You'll get more than 100 Mb of additional system memory.

Swap file
Do not swap! Manage your JVM memory consumption with  and   keys. If you absolutely have to swap move swap file (/var/swap) to USB HDD of fast flash drive because swapping to SD card is painfully slow. You can set swap size in /etc/dphys-swapfile config file.

Overclocking
Consider CPU overclocking with  for considerable performance boost.

Oracle Java 8
Oracle JDK 8 for ARM has JIT compiler and supports hard float point instructions. This is the fastest (1.5x-10x times faster than other JVMs) Java option for Raspberry Pi. Please note that Java 8 is still in beta stage and may be less stable than Java 7. You can install it on standard Raspbian system.


 * Visit JDK 8 for ARM Early Access web site, accept License Agreement, right click and copy download link.

wget http://www.java.net/download/JavaFXarm/jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz tar zxf jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz rm jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz sudo mv ./jdk1.8.0/ /opt/ sudo chown root:root -R /opt/jdk1.8.0/ sudo ln -s /opt/jdk1.8.0/ /opt/jdk8
 * Login to you Pi via ssh and run:
 * 1) you download link from step 1

PATH="$PATH":/opt/jdk8/bin JAVA_HOME=/opt/jdk8
 * Edit  and add these lines to the end of file:

java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b36e) Java HotSpot(TM) Client VM (build 25.0-b04, mixed mode)
 * Logout and re-login via SSH. Run  to see if java is working. You should see something like:


 * Congratulations!