In this post I will show you how to install JDK7 in Ubuntu without using PPA. The thing with PPA is that you can not always trust the source. To begin, we need to download the JDK7 package (compressed tar) from Oracles website.
From the JDK download select the Linux tar.gz file. I am using an x86 machine. So I will download the the i586.tar.gz version.
When prompted save the file some where appropriate. I am will save it to the Downloads folder in my home.
Next extract the downloaded package using the following command:
tar -xvf ~/Downloads/jdk-7u17-linux-i586.tar.gz
Next create a folder to host the JDK by running the following command
sudo mkdir -p /usr/lib/jvm/jdk1.7.0_17
The move all the content of the extracted file to the location we create above by running the following command:
sudo mv jdk1.7.0_17/* /usr/lib/jvm/jdk1.7.0_17/
Next run the following commands to make the javac, java, and javaws available system wide.
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_17/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_17/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_17/bin/javaws" 1
Next create a mozilla plugin folder in your home direcory
Finally, create a symbolic link to your Mozilla plugins folder. For 64-bit systems, replace ‘i386’ with ‘amd64’.
ln -s /usr/lib/jvm/jdk1.7.0/jre/lib/i386/libnpjp2.so ~/.mozilla/plugins/
That is that, Happy coding with Java