리눅스(CentOS)에 JDK 설치
CentOS 기준임.
http://www.oracle.com/technetwork/java/javase/downloads/jdk6u37-downloads-1859587.html
Java SE Development Kit 6 Update 37 다운로드 (jdk-6u37-linux-i586-rpm.bin)
/usr/local/src 폴더에 파일을 옮기고 실행권한을 줌
JDK 설치
# cd /usr/local/src
# chmod 744 jdk-6u37-linux-i586-rpm.bin
# ./jdk-6u37-linux-i586-rpm.bin
Unpacking...
Checksumming...
Extracting....
.
.
Done.
# ll *rpm*
-rwxr--r-- 1 root root 68604823 Nov 5 10:43 jdk-6u37-linux-i586-rpm.bin
-rw-r--r-- 1 root root 58433453 Sep 25 05:19 jdk-6u37-linux-i586.rpm
-rw-r--r-- 1 root root 499375 Nov 3 2010 sun-javadb-client-10.6.2-1.1.i386.rpm
-rw-r--r-- 1 root root 14627 Nov 3 2010 sun-javadb-common-10.6.2-1.1.i386.rpm
-rw-r--r-- 1 root root 4080625 Nov 3 2010 sun-javadb-core-10.6.2-1.1.i386.rpm
-rw-r--r-- 1 root root 969861 Nov 3 2010 sun-javadb-demo-10.6.2-1.1.i386.rpm
-rw-r--r-- 1 root root 4865183 Nov 3 2010 sun-javadb-docs-10.6.2-1.1.i386.rpm
-rw-r--r-- 1 root root 201273 Nov 3 2010 sun-javadb-javadoc-10.6.2-1.1.i386.rpm
# yum list | grep jdk
# cd /usr/java
# ll
total 16
lrwxrwxrwx 1 root root 16 Nov 5 10:45 default -> /usr/java/latest
drwxr-xr-x 7 root root 4096 Nov 5 10:45 jdk1.6.0_37
lrwxrwxrwx 1 root root 21 Nov 5 10:45 latest -> /usr/java/jdk1.6.0_37
환경변수 설정
# vi /etc/profile
맨 아래쪽에 해당 내용 추가
export JAVA_HOME=/usr/java/default
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$CLASSPATH:JAVA_HOME/lib
# source /etc/profile
시스템 JDK 등록/설정
# java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.4) (rhel-1.24.1.10.4.el5-i386)
OpenJDK Server VM (build 20.0-b11, mixed mode)
오픈JDK로 설정되어있음
# alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_37/bin/java 2
# alternatives --config java
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
2 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
3 /usr/java/jdk1.6.0_37/bin/java
Enter to keep the current selection[+], or type selection number: 3 <- jdk1.6.0_37 인 번호를 선택
# java -version
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06)
Java HotSpot(TM) Server VM (build 20.12-b01, mixed mode)
Java SE로 설정됨