首页 > 代码库 > UbuntuKylin安装SUN JDK1.7

UbuntuKylin安装SUN JDK1.7

1.下载jdk1.7.0_67并且解压,放知道/usr/local/lib/jvm目录下

tar zxvf jdk1.7.0_67.tar.gz

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

2.编辑~/.bashrc文件,添加如下内容。

JAVA_HOME后的内容为你自定义的JDK存放目录


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

export JRE_HOME=${JAVA_HOME}/jre

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

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


3.设置JDK默认版本

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)


本文出自 “Linux Windows 安全” 博客,请务必保留此出处http://3135888.blog.51cto.com/3125888/1547143

UbuntuKylin安装SUN JDK1.7