UbuntuKylin安裝SUN JDK1.7

1.下載jdk1.7.0_67而且解壓,放知道/usr/local/lib/jvm目錄下java

tar zxvf jdk1.7.0_67.tar.gzbash

sudo mv jdk1.7.0_67 /usr/local/lib/jvmjvm

2.編輯~/.bashrc文件,添加以下內容。ide

JAVA_HOME後的內容爲你自定義的JDK存放目錄ui


export JAVA_HOME=/usr/local/lib/jvm/jdk1.7.0_67it

export JRE_HOME=${JAVA_HOME}/jreio

exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/libclass

export PATH=${JAVA_HOME}/bin:$PATHjdk


3.設置JDK默認版本date

sudo update-alternatives --install "/usr/bin/java/" "java" "/usr/local/lib/jvm/jdk1.7.0_67/bin/java" 300


sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/lib/jvm/jdk1.7.0_67/bin/javac" 300


sudo update-alternatives --install "/usr/bin/jar" "jar" "/usr/local/lib/jvm/jdk1.7.0_67/bin/jar" 300


sudo update-alternatives --install "/usr/bin/javah" "javah" "/usr/local/lib/jvm/jdk1.7.0_67/bin/javah" 300


sudo update-alternatives --install "/usr/bin/javap" "javap" "/usr/local/lib/jvm/jdk1.7.0_67/bin/javap" 300 


sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/lib/jvm/jdk1.7.0_67/bin/javaws" 300 


sudo update-alternatives --set java /usr/local/lib/jvm/jdk1.7.0_67/bin/java

sudo update-alternatives --set javac /usr/local/lib/jvm/jdk1.7.0_67/bin/javac

sudo update-alternatives --set jar /usr/local/lib/jvm/jdk1.7.0_67/bin/jar

sudo update-alternatives --set javah /usr/local/lib/jvm/jdk1.7.0_67/bin/javah

sudo update-alternatives --set javap /usr/local/lib/jvm/jdk1.7.0_67/bin/javap

sudo update-alternatives --set javaws /usr/local/lib/jvm/jdk1.7.0_67/bin/javaws


4.檢查

java -version

mik3y@mac:~$ java -version

java version "1.7.0_67"

Java(TM) SE Runtime Environment (build 1.7.0_67-b01)

Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

相關文章
相關標籤/搜索