在Ubuntu手動安裝Sun Java JDK


  1. sudo -s ./jdk-6u12-linux-i586.bin
  2. sudo gedit /etc/profile
    #set java environment
    JAVA_HOME=/home/xxxxxx/JAVA/jdk1.6.0_25
    export JRE_HOME=/home/xxxxxx/JAVA/jdk1.6.0_25/jre
    export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
    export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
  3. sudo update-alternatives --install /usr/bin/java java /home/xxxxxx/JAVA/jdk1.6.0_25/bin/java 300
  4. sudo update-alternatives --install /usr/bin/javac javac /home/xxxxxx/JAVA/jdk1.6.0_25/bin/javac 300
  5. sudo update-alternatives --config java
  6. java -version