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
wget http://mirrors.fe.up.pt/pub/apache//ant/binaries/apache-ant-1.9.3-bin.tar.gz
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/
wget http://apache.cs.utah.edu/maven/maven-3/3.2.1/binaries/apache-maven-3.2.1-bin.tar.gz
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