Linux源码安装Java
1、到官网下载
jdk-8u131-linux-x64.tar.gz 官网地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2、解压安装包,重命名为jdk
[root@QIANZI-BASE home]# tar -zvxf jdk-8u131-linux-x64.tar.gz [root@QIANZI-BASE home]# mv jdk1.8.0_131 jdk
3、安装jdk到/usr/local/
[root@QIANZI-BASE home]# mv jdk /usr/local/
[root@QIANZI-BASE home]# cd /usr/local/
4、配置环境变量
vim /etc/profile
export JAVA_HOME=/usr/local/jdk export JRE_HOME=/usr/local/jdk/jre export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
5、使立即生效
source /etc/profile
6、验证
[root@jikon-master local]# java -version java version "1.8.0_192" Java(TM) SE Runtime Environment (build 1.8.0_192-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)