Tomcat系列—JDK安装

时间:2022-06-22 16:36:39

1、下载并解压源码包

[root@localhost src]# wget http://mirrors.theltfire.com/jdk-7u79-linux-x64.tar.gz
[root@localhost src]# tar xvf jdk-8u131-linux-x64.tar.gz

2、配置环境变量

[root@localhost jdk1.8.0_131]# vim /etc/profile.d/jdk.sh

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

3、加载刚设置的变量

[root@localhost jdk1.8.0_131]# source /etc/profile

4、测试是否安装成功

[root@localhost jdk1.8.0_131]# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)