how to install jdk or java on centos 7

2019. 6. 25. 20:47OS/리눅스

반응형

yum -y update


yum install java-1.8.0-openjdk


yum install java-1.8.0-openjdk -y


java -version


update-alternatives --config java


vi .bash_profile

       ### 하단에 추가 ###

       export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java

       ### java -version 으로 나오는 버전을  export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk 뒤에 삽입해야함


source .bash_profile


echo $JAVA_HOME
      /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java

 

반응형