1 of 6

The way to install the Java JDK is to run the following commands:

sudo apt-get install openjdk-7-jre

This installs the Java JRE (Java Runtime Environment) which will allow you to run applications written in Java.

You asked for the JDK so to install that also do:

sudo apt-get install openjdk-7-jdk

This allows you to compile Java applications to bytecode.

If you want the Oracle Java system (which may be slightly faster and is also a developer preview so developing with this would not be a good idea until some time into the future), instead of the above instructions you need to download the file called Oracle JDK 8 (with JavaFX) for ARM Early Access on the Oracle Java JDK page.

Remember to download the Oracle Java system on your Pi, or you won't be able to install it.

To install the Oracle Java System:

tar zxvf jdk-8-ea-b36e-linux-arm-hflt-29_nov_2012.tar.gz
sudo mv jdk1.8.0 /usr/local/java
export PATH=$PATH:/usr/local/java/bin
java -version

Then it is all installed.