Skip to content
PeteManchester edited this page Jul 25, 2018 · 4 revisions

The newer version of Raspi already have Java installed and so the notes below are for reference only.

There are many different ways to install Java.

The easiest way is to use the command

sudo apt-get install oracle-java(x)-jdk

Where (x) is the version of Java.

But older versions of Raspi might not support this.

Below is another way to install Java if the above method doesn't work (the version numbers may change, please check the version of Java required by MediaPlayer)

copy to /home/pi directory  

sudo mkdir -p -v /opt/java

tar xvzf ~/jdk-7u45-linux-arm-vfp-hflt.gz

sudo mv -v ~/jdk1.7.0_45 /opt/java

rm ~/jdk-7u45-linux-arm-vfp-hflt.gz

sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk1.7.0_45/bin/java" 1

sudo update-alternatives --set java /opt/java/jdk1.7.0_45/bin/java

The third option is to install OpenJDK, it is very simple to install but some people think that it's performance is not as quick as Oracle JDK.

sudo apt-get install openjdk-7-jdk

If space on the SD card is a concern and you are not going to compile any Java on the Raspberry Pi then you could consider installing the JRE instead of JDK. For example:

sudo apt-get install oracle-java7-jre

Or

sudo apt-get install openjdk-7-jre

Clone this wiki locally