标签:nat config .bashrc run linux bit java alter build
1、下载jdk包
jdk-7u79-linux-x64.tar.gz
2、拷贝到服务器指定目录
scp -r /users/admin/downloads/jdk-7u79-linux-x64.tar.gz zealon@192.168.2.163:/usr/lib/jvm/
3、解压jdk包
sudo tar -zxvf jdk-7u79-linux-x64.tar.gz
4、修改环境变量
sudo vim ~/.bashrc
5、追加配置
#set oracle jdk environment
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_80
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
6、设置默认jdk版本
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_80/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_80/bin/javac 300
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.7.0_80/bin/jar 300
sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk1.7.0_80/bin/javah 300
sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.7.0_80/bin/javap 300
sudo update-alternatives --config java
7、查看java版本
java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
Ubuntu安装JDK
标签:nat config .bashrc run linux bit java alter build
原文地址:http://www.cnblogs.com/zealon/p/7380514.html