본문 바로가기
OS & Server/Linux

[Centos7] Open JDK18 (JAVA Development Kit) 업데이트

by 주리니e 2022. 7. 15.
728x90

[Centos7] Open JDK18 (JAVA Development Kit)  업데이트

 

 

  • JAVA 설치 여부 확인
$ java -version
openjdk version "11.0.15" 2022-04-19 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.15+9-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.15+9-LTS, mixed mode, sharing)

 

  • 설치 가능한 JDK 목록 조회
$ yum list java*jdk-devel 
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
java-1.6.0-openjdk-devel.x86_64                                                                   1:1.6.0.41-1.13.13.1.el7_3                                                                   base        
java-1.7.0-openjdk-devel.x86_64                                                                   1:1.7.0.261-2.6.22.2.el7_8                                                                   base        
java-1.8.0-openjdk-devel.i686                                                                     1:1.8.0.332.b09-1.el7_9                                                                      updates     
java-1.8.0-openjdk-devel.x86_64                                                                   1:1.8.0.332.b09-1.el7_9                                                                      updates     
java-11-openjdk-devel.i686                                                                        1:11.0.15.0.9-2.el7_9                                                                        updates     
java-11-openjdk-devel.x86_64                                                                      1:11.0.15.0.9-2.el7_9                                                                        updates     
java-latest-openjdk-devel.x86_64                                                                  1:18.0.1.0.10-2.rolling.el7                                                                  fedorapoject

 

  • Yum을 이용한 Open JDK18 설치
$ yum install java-latest-openjdk-devel.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
CodeIT                                                                                                                                                                              | 3.0 kB  00:00:00     
base                                                                                                                                                                                | 3.6 kB  00:00:00     
extras                                                                                                                                                                              | 2.9 kB  00:00:00     
fedorapoject                                                                                                                                                                        | 4.7 kB  00:00:00     
updates                                                                                                                                                                             | 2.9 kB  00:00:00     
Resolving Dependencies

...

Installed:
  java-latest-openjdk-devel.x86_64 1:18.0.1.0.10-2.rolling.el7                                                                                                                                             

Dependency Installed:
  graphite2.x86_64 0:1.3.10-1.el7_3        harfbuzz.x86_64 0:1.7.5-2.el7     java-latest-openjdk.x86_64 1:18.0.1.0.10-2.rolling.el7     java-latest-openjdk-headless.x86_64 1:18.0.1.0.10-2.rolling.el7    
  libXcomposite.x86_64 0:0.4.4-4.1.el7    

Complete!

 

  • 업데이트된 JAVA 버전 사용
$ update-alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.15.0.9-2.el7_9.x86_64/bin/java)
   2           java-latest-openjdk.x86_64 (/usr/lib/jvm/java-18-openjdk-18.0.1.0.10-2.rolling.el7.x86_64/bin/java)

Enter to keep the current selection[+], or type selection number: 2
update-alternatives --config javac

There are 2 programs which provide 'javac'.

  Selection    Command
-----------------------------------------------
*+ 1           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.15.0.9-2.el7_9.x86_64/bin/javac)
   2           java-latest-openjdk.x86_64 (/usr/lib/jvm/java-18-openjdk-18.0.1.0.10-2.rolling.el7.x86_64/bin/javac)

Enter to keep the current selection[+], or type selection number: 2

새로 설치한 2번 버전을 선택한다.

 

  • JAVA 환경변수 수정
$ vi /etc/profile

export JAVA_HOME=/usr/lib/jvm/java-18-openjdk-18.0.1.0.10-2.rolling.el7.x86_64
export PATH=$PATH:$JAVA_HOME/bin

기존에 환경변수를 등록한 경우에 수정한다.

 

  • JAVA 버전 확인
$ java -version
openjdk version "18.0.1" 2022-04-19
OpenJDK Runtime Environment 21.9 (build 18.0.1+10)
OpenJDK 64-Bit Server VM 21.9 (build 18.0.1+10, mixed mode, sharing)

 

728x90

댓글