Installing JDK 1.8 on the Raspberry Pi

These are my notes on installing JDK 1.8 on the Raspberry Pi, loosely based on these:

# unpack 
sudo mkdir /opt/java
cd /opt/java
sudo tar -zxvf /tmp/jdk-8-linux-arm-vfp-hflt.tar.gz

# let the system know there's a new JVM
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk1.8.0/bin/java" 1
sudo update-alternatives --set java /opt/java/jdk1.8.0/bin/java

# append these to /etc/profile
export JAVA_HOME="/opt/java/jdk1.8.0"
export PATH=$PATH:$JAVA_HOME/bin

Adding Ant and Maven

cd /opt/java
sudo tar -zxvf apache-ant-1.9.3-bin.tar.gz
sudo ln -s apache-ant-1.9.3 ant 
sudo rm -rf apache-ant-1.9.3/manual/

cd /opt/java
sudo tar -zxvf apache-maven-3.2.1-bin.tar.gz
sudo ln -s apache-maven-3.2.1 maven

# append this to /etc/profile
export PATH=$PATH:$JAVA_HOME/../maven/bin:$JAVA_HOME/../ant/bin