Sunday, December 25, 2011

How to install Java 1.7.0 in Ubuntu 11.10


If you would like to use Oracle's proprietary Java over what comes with most Linux Distributions openJDK you can remove the openJDK by executing the following:

sudo apt-get remove --purge jdk* 


Follow the steps below to install Oracle's proprietary Java:


Download the 32 or 64 bit version here: http://goo.gl/bNTUh

tar xvf jdk-7-linux-x64.tar.gz

sudo mkdir /usr/lib/jvm

sudo mv jdk1.7.0/ /usr/lib/jvm/jdk1.7.0/
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1

sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
sudo update-alternatives --config java 
java -version

[output should be]

java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

 

No comments:

Post a Comment