Java 7 Installation on Ubuntu 12.04

Download the newest version of java available from Oracle. Depending on your OS architecture, download either the “Linux x86” or “Linux x64” tar.gz file. Once downloaded, fire up WinSCP and copy the file to your Ubuntu Server /tmp directory.  Next in terminal run the following commands:

cd /tmp
tar -xvf jre-7u40-linux-x64.tar.gz
mv jre1.7.0_40 /usr/lib/jvm/jre1.7.0_40/

#(deactivate old java)
update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.7.0_25/bin/java" 0

#(activate new java)
update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.7.0_40/bin/java" 1

#(verify installation)
java -version
Did you find this article useful? Why not share it with your friends?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.