1、下载jdk1.8:http://download.csdn.net/download/yichen01010/10017267
直接使用liunx下默认安装的浏览器 下载
2、卸载系统自带的jdk
第一步使用liunx命令查询系统中自带的jdk,下图有些区别,以文字为主
命令:rpm -qa|grep java 查询带有java的包
第二步:卸载所有系统自带jdk
命令
rpm -e --nodeps 上面查询到的文件名
如下例:
3、使用liunx命令创建文件夹
命令
cd /usr 进入usr目录
mkdir app 在当前目录下创建app文件夹
rm -rf /usr/app 删除指定文件夹
ls -a 列出文件夹下的所有文件
cp -r 文件 文件夹 将文件拷贝到指定文件夹
tar -zvxf 文件 文件夹 将文件解压缩到指定文件夹
4、设置jdk环境变量
第一步进入环境变量配置文件
命令 vim /etc/profile
输入命令 e 开始编辑
输入命令 i 开始编辑,在文件最后输入
export JAVA_HOME=/usr/java/jdk1.8.0_144
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
红色部分换成你的jdk地址
按键盘exc键后,输入:wq保存文件并退出
使生效
source /etc/profile
检验版本
java -version