Linux安装Java环境
- 在线下载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
- 赋权限
chmod +x jdk-8u131-linux-x64.rpm
- 进行安装
rpm -ivh jdk-8u131-linux-x64.rpm
- 查看是否安装成功
java -version
- 编辑环境变量(默认安装路径为 /usr/java/jdk1.8.0_131)
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
- 使得配置立即生效
source /etc/profile
- 查看是否安装成功
javac java -version echo $PATH
本文来自博客园,作者:LiJialong,转载请注明原文链接:https://www.cnblogs.com/carver/articles/17674425.html