1.从oracle官网下载java最新版压缩包
2.解压 “tar -zxvf tarball_name
3.sudo mkdir /usr/lib/java
4.mv jdk1.8.0_40 to /usr/lib/java/
5.执行下面的命令行
sudo update-alternatives –install “/usr/bin/java” “java” “/usr/lib/java/jdk1.7.0_65/bin/java” 1
sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/lib/java/jdk1.7.0_65/bin/javac” 1
sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/lib/java/jdk1.7.0_65/bin/javaws” 1
6.在这个文件 ~/.bashrc最后添加:
export JAVA_HOME=/usr/lib/java/jdk1.7.0_65
set PATH=”PATH:JAVA_HOME/bin”
export PATH
7.重启
sudo ln -s -v jdk1.7.0_09/bin/java /usr/bin/java
时间: 2024-10-13 05:56:27