OS/Ubuntu

JDK 설치

Lawmin 2012. 3. 12. 10:50

Ubuntu 10.04 64bit (LTS) jdk1.6.0.31 설치


 

1. JDK 다운

-http://www.oracle.com 접속 

- 탭에 Downloads 

- 우측에 popular downloads에서 java SE 클릭

- 스크롤 조금 내리고 JAVA SE 6 Update 31 에서 JDK 클릭

- Access License agreement 체크하고, 사양에 맞는 것을 다운 (64bit)(


2. JDK 설치

$ mv jdk-6u31-linux-x64.bin /usr/lib/jvm

# chmod a+x /usr/lib/jvm/jdk-6u31-linux-x64.bin

# ./jdk-6u31-linux-x64.bin 

 

root@lawmin:/usr/lib/jvm/jdk1.6.0_31# update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_31/jre/bin/java 1     


root@lawmin:/usr/lib/jvm/jdk1.6.0_31# ls

bin        demo     lib      README.html       register_zh_CN.html  THIRDPARTYLICENSEREADME.txt

COPYRIGHT  include  LICENSE  register.html     sample

db         jre      man      register_ja.html  src.zip

root@lawmin:/usr/lib/jvm/jdk1.6.0_31# update-alternatives --config java

There are 2 choices for the alternative java (providing /usr/bin/java).


  Selection    Path                                      Priority   Status

------------------------------------------------------------

* 0            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      auto mode

  1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode

  2            /usr/lib/jvm/jdk1.6.0_31/jre/bin/java      1         manual mode


Press enter to keep the current choice[*], or type selection number: 2

update-alternatives: using /usr/lib/jvm/jdk1.6.0_31/jre/bin/java to provide /usr/bin/java (java) in manual mode.

root@lawmin:/usr/lib/jvm/jdk1.6.0_31# 


3. PATH 
설정

 /etc/profile 수정


export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_31

export PATH=$PATH:$JAVA_HOME/bin:


# source /etc/profile

 

$ java

$ java –version