Linux安装java1.8

1.在线下载jdk

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm

2.赋权限

chmod +x jdk-8u131-linux-x64.rpm

3.进行安装

rpm -ivh jdk-8u131-linux-x64.rpm

4.查看是否安装成功

java -version

默认安装路径为 /usr/java/jdk1.8.0_131

5.编辑环境变量

vim /etc/profile

环境变量为

export JAVA_HOME=/usr/java/jdk1.8.0_131
export PATH=$JAVA_HOME/bin:$PATH 
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 

6.使得配置立即生效

source /etc/profile

7.查看是否安装成功

javac
java -version
echo $PATH

 

你可能感兴趣的:(Linux安装java1.8)