1. 오라클 사이트에서 다운로드

 

http://www.oracle.com/java/technologies/javase7-archive-downloads.html 

 

jdk-7u80-linux-x64.tar.gz 를 다운받는다.

 

 

2. 서버에 업로드

 

3. 압축을 푼다.

 

[root@localhost ellord]# tar xvfz jdk-7u80-linux-x64.tar.gz 

 

 

4. 압축이 풀린 폴더를 /usr/local 로 이동시켜 준다.

 

[root@localhost ellord]# mv jdk1.7.0_80/ /usr/local/

 

5. 심볼릭 링크를 만든다. java여러 버전을 관리하기 위해서.

 

[root@localhost local]# ln -s jdk1.7.0_80/ ./java

아래와 같이 java 심볼릭 링크가 생성되었다.

 

[root@localhost local]# ll
total 0
drwxr-xr-x. 2 root root   6 Apr 11  2018 bin
drwxr-xr-x. 2 root root   6 Apr 11  2018 etc
drwxr-xr-x. 2 root root   6 Apr 11  2018 games
drwxr-xr-x. 2 root root   6 Apr 11  2018 include
lrwxrwxrwx. 1 root root  12 Sep  1 15:48 java -> jdk1.7.0_80/
drwxr-xr-x. 8   10  143 233 Apr 11  2015 jdk1.7.0_80
drwxr-xr-x. 2 root root   6 Apr 11  2018 lib
drwxr-xr-x. 2 root root   6 Apr 11  2018 lib64
drwxr-xr-x. 2 root root   6 Apr 11  2018 libexec
drwxr-xr-x. 2 root root   6 Apr 11  2018 sbin
drwxr-xr-x. 5 root root  49 Aug 31 16:53 share
drwxr-xr-x. 2 root root   6 Apr 11  2018 src
[root@localhost local]# 

 

6. 현재 자바 버전을 확인해 본다.

 

[root@localhost local]# java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
[root@localhost local]# 

openjdk 1.8이 설치되어 있다.

 

방금 설치한 jdk1.7로 변경하려고 한다.

 

7. alternatives 심볼릭 링크 생성

[root@localhost local]# alternatives --install /usr/bin/java java /usr/local/java/bin/java 2
[root@localhost local]# alternatives --install /usr/bin/java javac /usr/local/java/bin/javac 2
[root@localhost local]# alternatives --install /usr/bin/java javaws /usr/local/java/bin/javaws 2
[root@localhost local]# 
[root@localhost local]# alternatives --set java /usr/local/java/bin/java
[root@localhost local]# alternatives --set javac /usr/local/java/bin/javac
[root@localhost local]# alternatives --set javaws /usr/local/java/bin/javaws
[root@localhost local]# 

 

8. 심볼릭 링크 확인

[root@localhost local]# alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-1.el7.x86_64/jre/bin/java)
 + 2           /usr/local/java/bin/java

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

2번에 등록된 것 확인할 수 있다. 

2를 입력하고 엔터.

 

확인해 본다.

[root@localhost local]# java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
[root@localhost local]# 

변경이 잘 되었다.

 

 

 

 

 

 

 

 

 

 

 

 

 

블로그 이미지

엘로드넷

댓글을 달아 주세요