centos7 mininal安装,需要自己安装jdk1.8,步骤

时间:2022-05-10 15:20:56

$wget http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-linux-x64.rpm?AuthParam=1450704375_3a79fcdb7f951c5f0ba93a109a431ba5

$sudo rpm –ivh jdk-8u66-linux-x64.rpm

Jdk默认安装在/usr/java中,这个要看一下

配置环境变量:

$vi + /etc/profile

向文件里追加一下内容:

JAVA_HOME=/usr/java/jdk1.8.0_25

JRE_HOME=/usr/java/jdk1.8.0_25/jre

PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

export JAVA_HOME JRE_HOME PATH CLASSPATH

 

是修改生效

[root@localhost~]#source /etc/profile

[root@localhost~]#echo $PATH