背景
yum安装很方便,实在是懒得一直拷贝安装包了。
安装方法
yum install java-1.8.0-openjdk.x86_64
查找jdk安装的位置
[root@localhost]# which java
/bin/java
[root@localhost]# ls -l /bin/java
lrwxrwxrwx. 1 root root 22 Mar 22 01:01 /bin/java -> /etc/alternatives/java
[root@localhost]# ls -l /etc/alternatives/java
lrwxrwxrwx. 1 root root 73 Mar 22 01:01 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64/jre/bin/java
配置javahome
vi /etc/profile
最后一行加入
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64/jre
export PATH=$PATH:$JAVA_HOME/bin
配置生效
source /etc/profile
原文链接:/jvm/997322.html