Install sun-jdk-1.6 on Ubuntu11.04

setp1: download jdk-6u27-linux-i586.bin

setp2: Create Folder

michael@XXXX:/opt$ sudo mkdir eclipseIDE
michael@XXXX:/opt$ sudo mkdir jvm
michael@XXXX:/opt$ ls
eclipseIDE  jvm

setp3:copy jdk-6u27-linux-i586.bin  to /opt/jvm

michael@XXXX:/opt$ sudo cp /media/eclipse_and_project/tool/jdk-6u27-linux-i586.bin  /opt/jvm/jdk-6u27-linux-i586.bin

setp4: Install  jdk-6u27-linux-i586.bin

michael@XXXX:/opt$ sudo sh /opt/jvm/jdk-6u27-linux-i586.bin

 setp5: setting  java configure

michael@XXXX:/opt$ sudo gedit /etc/environment 

wireted:

export JAVA_HOME=/opt/jvm/jdk1.6.0_27
export JRE_Home=/opt/jvm/jdk1.6.0_27/jre
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JRE_HOME/lib

 setp6: make it effective

michael@XXXX:/opt$ source ~/.bashrc

 setp7: choose a default  jdk

michael@XXXX:/opt$ sudo update-alternatives --install /usr/bin/java java /opt/jvm/jdk1.6.0_27/bin/java 300
michael@XXXX:/opt$ sudo update-alternatives --install /usr/bin/javac javac /opt/jvm/jdk1.6.0_27/bin/javac 300
michael@XXXX:/opt$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                      Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      auto mode
* 1            /opt/jvm/jdk1.6.0_27/bin/java              300       manual mode
  2            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode

Press enter to keep the current choice[*], or type selection number: 1

michael@XXXX:/opt$ java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) Server VM (build 20.2-b06, mixed mode)
michael@michael-F5V:/opt$
 

相关推荐