(주)누리웨어

화상연동/Web,APP 구축및서비스/LMS/평생교육/학점은행/기업교육/연수관리/설문구축/

Linux(CentOS) open java 8 install

1.java 확인
[root@hae bin]# which java
/usr/bin/java
2.없을 경우 yum install
[root@hae ~]# yum install java-1.8.0-openjdk

3.확인
[root@hae ~]# which java
/usr/bin/java
[root@hae ~]# cd /usr/bin
[root@hae bin]# ls -al|grep java
lrwxrwxrwx. 1 root root 26 Feb 19 19:25 alt-java -> /etc/alternatives/alt-java
lrwxrwxrwx. 1 root root 22 Feb 19 19:25 java -> /etc/alternatives/java
[root@hae bin]# cd /etc/alternatives/
[root@hae alternatives]# ls -al|grep java
lrwxrwxrwx. 1 root root 77 Feb 19 19:25 alt-java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/alt-java
lrwxrwxrwx. 1 root root 81 Feb 19 19:25 alt-java.1.gz -> /usr/share/man/man1/alt-java-java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64.1.gz
lrwxrwxrwx. 1 root root 73 Feb 19 19:25 java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/java
lrwxrwxrwx. 1 root root 77 Feb 19 19:25 java.1.gz -> /usr/share/man/man1/java-java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64.1.gz
lrwxrwxrwx. 1 root root 72 Feb 19 19:25 jjs -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/jjs
lrwxrwxrwx. 1 root root 76 Feb 19 19:25 jjs.1.gz -> /usr/share/man/man1/jjs-java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64.1.gz
lrwxrwxrwx. 1 root root 64 Feb 19 19:25 jre -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre
lrwxrwxrwx. 1 root root 64 Feb 19 19:25 jre_1.8.0 -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre
lrwxrwxrwx. 1 root root 64 Feb 19 19:25 jre_1.8.0_exports -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre
lrwxrwxrwx. 1 root root 68 Feb 19 19:25 jre_1.8.0_openjdk_exports -> /usr/lib/jvm-exports/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64
lrwxrwxrwx. 1 root root 64 Feb 19 19:25 jre_openjdk -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre
lrwxrwxrwx. 1 root root 64 Feb 19 19:25 jre_openjdk_exports -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre
lrwxrwxrwx. 1 root root 76 Feb 19 19:25 keytool -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/keytool
lrwxrwxrwx. 1 root root 80 Feb 19 19:25 keytool.1.gz -> /usr/share/man/man1/keytool-java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64.1.gz
lrwxrwxrwx. 1 root root 73 Feb 19 19:25 orbd -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/orbd
lrwxrwxrwx. 1 root root 77 Feb 19 19:25 orbd.1.gz -> /usr/share/man/man1/orbd-java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64.1.gz
lrwxrwxrwx. 1 root root 76 Feb 19 19:25 pack200 -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/pack200
lrwxrwxrwx. 1 root root 80 Feb 19 19:25 pack200.1.gz -> /usr/share/man/man1/pack200-java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64.1.gz
lrwxrwxrwx. 1 root root 79 Feb 19 19:25 policytool -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/policytool
lrwxrwxrwx. 1 root root 83 Feb 19 19:25 policytool.1.gz -> /usr/share/man/man1/policytool-java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64.1.gz
lrwxrwxrwx. 1 root root 73 Feb 19 19:25 rmid -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/rmid
lrwxrwxrwx. 1 root root 77 Feb 19 19:25 rmid.1.gz -> /usr/share/man/man1/rmid-java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64.1.gz
lrwxrwxrwx. 1 root root 80 Feb 19 19:25 rmiregistry -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/rmiregistry
lrwxrwxrwx. 1 root root 84 Feb 19 19:25 rmiregistry.1.gz -> /usr/share/man/man1/rmiregistry-java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64.1.gz
lrwxrwxrwx. 1 root root 79 Feb 19 19:25 servertool -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/servertool
lrwxrwxrwx. 1 root root 83 Feb 19 19:25 servertool.1.gz -> /usr/share/man/man1/servertool-java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64.1.gz
lrwxrwxrwx. 1 root root 78 Feb 19 19:25 tnameserv -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/tnameserv
lrwxrwxrwx. 1 root root 82 Feb 19 19:25 tnameserv.1.gz -> /usr/share/man/man1/tnameserv-java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64.1.gz
lrwxrwxrwx. 1 root root 78 Feb 19 19:25 unpack200 -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/unpack200
lrwxrwxrwx. 1 root root 82 Feb 19 19:25 unpack200.1.gz -> /usr/share/man/man1/unpack200-java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64.1.gz
[root@hae alternatives]# pwd
/etc/alternatives
[root@hae alternatives]#

4.openjdk-devel install
===실서버=====
1.yum 설치 확인
[root@localhost ~]# yum list java*jdk-devel
Last metadata expiration check: 0:45:16 ago on Tue 04 Jan 2022 06:15:10 AM KST.
Available Packages
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.312.b07-2.el8_5 appstream
java-11-openjdk-devel.x86_64 1:11.0.13.0.8-4.el8_5 appstream
java-17-openjdk-devel.x86_64 1:17.0.1.0.12-2.el8_5 appstream

2.설치
[root@localhost ~]# yum -y install java-1.8.0-openjdk-devel.x86_64

3.버전 체크
[root@localhost ~]# java -version
openjdk version “1.8.0_312”
OpenJDK Runtime Environment (build 1.8.0_312-b07)
OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)

4.심볼릭 링크로 되어 있는 부분을 실제 위치를 넣어줌
[root@localhost ~]# readlink -f /usr/bin/javac
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/bin/javac

5.JAVA_HOME에 등록
vi /etc/profile
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64

개발서버
[root@hae alternatives]# yum install java-1.8.0-openjdk-devel

5.자바환경설정(개발프로그램에서 환경을 잡아줄경우는 필요없음)

JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar

export JAVA_HOME PATH CLASSPATH

source /etc/profile

Comments are currently closed.