Linux 上JDK 1.7 安装
下载linux版的JDK
1.上传至Linux,解压
[root@js usr]# mkdir /usr/java [root@js usr]# tar -zxvp -f jdk-7-linux-x64.tar.gz /usr/java
2.配置环境变量
[root@js jdk1.7.0]# vim /etc/bashrc
末尾加上
JAVA_HOME=/usr/java/jdk1.7.0
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME
export CLASSPATH
export PATH
3.由于Linux自带openjdk,修改默认jdk
[root@js jdk1.7.0]# alternatives --install /usr/bin/java java /usr/java/jdk1.7.0/bin/java 300 [root@js jdk1.7.0]# alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0/bin/javac 300 [root@js jdk1.7.0]# alternatives --config java There are 2 programs which provide 'java'. Selection Command ----------------------------------------------- *+ 1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java 2 /usr/java/jdk1.7.0/bin/java Enter to keep the current selection[+], or type selection number: 2
4.验证
[root@js jdk1.7.0]# java -version java version "1.7.0" Java(TM) SE Runtime Environment (build 1.7.0-b147) Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
posted on 2015-09-26 00:27 JusonSummer 阅读(177) 评论(0) 编辑 收藏 举报