1. os 버전 확인 

sudo rpm -qa *-release

2. java 설치 가능한지 확인

yum list java*jdk-devel

3. jdk8이 없는 경우 yum repo 설정 확인

sudo vi /etc/yum.repos.d/CentOS-Base.repo

 

[base]

mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os

 

[updates]

mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates

 

[extras]

mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras

 

[centosplus]

mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus

 

[contrib]

mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib

 

5. 설치

sudo yum install java-1.8.0-openjdk-devel

6. 설치 확인

java -version

7. 환경 변수 확인

echo $JAVA_HOME

sudo which javac

readlink -f /usr/bin/javac

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64

8. 환경 변수 설정

vi .bash_profile

echo "export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el6_10.x86_64" >> ~/.bash_profile

 

 

source .bash_profile

7. 환경 변수 확인

echo $JAVA_HOME

 

 

[mac]

brew tap AdoptOpenJDK/openjdk

brew cask install adoptopenjdk8

export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home

+ Recent posts