Posted on 2015-09-29 21:25
AntiquMan 阅读(574)
评论(0) 编辑 收藏 所属分类:
Linux
1. 安装前,最好先删除Linux自带的OpenJDK:
(1)运行java-version,会发现Linux自带的OpenJDK,运行rpm -qa | grep OpenJDK,找出自带的OpenJDK名称;
(2)运行rpm - nodeps -e OpenJDK名称,删除OpenJDK;
2. 下载jdk-8u20-linux-x64.rpm,运行rpm -ivh jdk-8u20-linux-x64.rpm安装;
3. 运行vim /etc/profile,在文件末尾输入以下几行:
export JAVA_HOME=/usr/java/jdk1.8.0_20
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
保存,退出;
4. 运行source /etc/profile,使/etc/profile文件生效,或者重启;
5. 运行java -version,返回结果如下:
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
说明JDK1.8已经安装成功!
---------------------Jrockit JDK 16
JAVA_HOME="/root/jrockit-jdk1.6.0_45-R28.2.7-4.1.0"
CLASSPATH=".:$JAVA_HOME/lib:$CLASSPATH"
PATH=".:$JAVA_HOME/bin:$PATH"
export JAVA_HOME CLASSPATH PATH