Tuesday, February 19, 2013

Multiple Java versions on ubuntu

$ wget http://download.oracle.com/otn-pub/java/jdk/6u34-b04/jdk-6u41-linux-x64.bin 
 $ chmod u+x jdk-6u41-linux-x64.bin 
 $ ./jdk-6u41-linux-x64.bin 
 $ sudo mkdir -p /usr/lib/jvm
 $ sudo cp -a jdk1.6.0_41/ /usr/lib/jvm/
 $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_41/bin/java" 1
 $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_41/bin/javac" 1
 

sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      auto mode
  1            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode
  2            /usr/lib/jvm/jdk1.6.0_41/bin/java                1         manual mode
* 3            /usr/lib/jvm/jdk1.7.0/bin/java                   1         manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/jdk1.6.0_41/bin/java to provide /usr/bin/java (java) in manual mode.

No comments:

Post a Comment