I had great trouble installing Oracle Java on my Raspberry Pi due to the liblji.so problem. So here are the instructions to get Oracle Java 7 up and running on a Raspberry Pi from scratch. You should know that the build we are going to use, uses a software floating point algorithm instead of the on-board hardware it is as a result slower than the other plain wheezy version. You should consider using the OpenJDK which is installed on the normal wheezy.
- Using the instructions Installing and setting up a Raspberry Pi, install Soft-float Debian “wheezy”,
2013-05-29-wheezy-armel(at the time of writing).
- Navigate to the Java SE Downloads and click through JDK and get a copy of Linux ARM v6/v7 Soft Float ABI (
- Copy the file to the Raspberry Pi (from the command line).
scp jdk-7u21-linux-arm-sfp.tgz firstname.lastname@example.org:/home/pi
- Open a PuTTY session to the Raspberry Pi.
- Do my
sudo bashtrick again to open a root shell. This will stop us having to write sudo in front of everything. It also has the handy benefit of separating the history of your sessions with extraneous commands that you wouldn’t normally use.
- Also there now! Create somewhere for Oracle Java to live and uncompress the downloaded zip file.
mkdir -p /opt/java cd /opt/java tar -xvzf /home/pi/jdk-7u21-linux-arm-sfp.tgz
- Now we’ll tell the system about the Oracle Java installation.
update-alternatives –install “/usr/bin/java” “java” “/opt/java/jdk1.7.0_21/bin/java” 1
- We must also tell the system that we want it to use this version of Oracle Java by default.
update-alternatives –set java /opt/java/jdk1.7.0_21/bin/java
- Now test:
root@drswifty:/home/pi# java -version java version “1.7.0_21″ Java™ SE Runtime Environment (build 1.7.0_21-b11) Java HotSpot™ Client VM (build 23.21-b01, mixed mode)
- The Java that has been installed here is the Java Runtime Environment (JRE). So when you type
javeyou’re getting the JRE version and not the Java Development Kit version and as a result you are not getting
javacwither. This is ok because all the applications on the platform will run under it. As developers we need the JDK version so we’ll have to rejig our
PATHenvironment variable so it picks up the JDK’s version of Java before the JRE’s. Edit
~/.bashrcand add the following lines:
export JAVA_HOME=`update-alternatives –list java | sed ’s>/bin/java>>’` export PATH=$JAVA_HOME/bin:$PATH
- Log out and log back in again and you should now have access to the Java Development Kit and the compiler tools e.g.
- Give yourself a pat on the back!
No feedback yet
Form is loading...