sudo add-apt-repository ppa:sun-java-community-team/sun-java6

sudo apt-get update

sudo apt-get install sun-java6-bin sun-java6-jdk


sudo update-alternatives --config java


* another method

http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u32-downloads-1594644.html

적당한 bin 파일 받음.

chmod 755 jdk-x.x.x.x.bin

./jdk-x.x.x.bin


ln -s /home/xxxx/jdk-x.x.x.x/ /usr/local/java

path 설정

vi .bashrc

PATH = 

JAVA_HOME = 

export path = 



http://blog.manishchhabra.com/2012/05/installing-oracle-sun-java-jdk-and-setting-java_home-in-ubuntu-linux/


Installing Oracle Sun Java (JDK) and setting JAVA_HOME in Ubuntu (Linux)

by Manish on May 6, 2012

This post is not only for people who are new to Linux or Java but also quick notes for me to setup my environment next time I install my system or setup a virtual machine.

Installing OpenJDK can be very simple but not Oracle JDK. You can use one of the two following commands (depending on which version you which to install) to setup OpenJDK in your linux environment.

sudo apt-get install openjdk-6-jdk
or
sudo apt-get install openjdk-7-jdk

But I have always used Oracle Sun JDK for my development. While Oracle JDK (earlier Sun JDK) is under the Binary Code License (earlier Sun License), OpenJDK is under GPL with a linking exception. From JDK version 7, Oracle has planned to support OpenJDK and withdraw the Operating System Distributor License for Java. This has resulted in a withdrawal of Oracle JDK from the repositories of Linux distributions. Therefore you can’t just use apt-get to install Oracle JDK.

Here is the stackoverflow link to help you choose between the Oracle JDK or OpenJDK.

But users who prefer to use the Oracle JDK binaries over OpenJDK builds packaged in their Linux distributions of choice can of course download the package fromhttp://oracle.com/java under the same terms as users on other platforms. Here is the direct link to JavaSE downloads.

Coming the point I have downloaded JDK 7 (update 4) for Linux x86 (32-bit) – file:jdk-7u4-linux-i586.tar.gz

Step 1: After downloading the file open the terminal and navigate to the file

tar -xf jdk-7u4-linux-i586.tar.gz

This will extract and create a jdk folder at your current path.

Step 2: Create a location to keep your new JDK . I prefer and usually use /usr/lib/jvm/

You may need root permission to create the /usr/lib/jvm (hence use sudo).

sudo mkdir /usr/lib/jvm 

Step 3: Move the extracted jdk folder to /usr/lib/jvm/

sudo mv jdk1.7.0_04 /usr/lib/jvm/

Step 4: Now we have to setup our system to use refer to our new jdk

sudo update-alternatives --install "/usr/bin/java" "java" \
"/usr/lib/jvm/jdk1.7.0_04/bin/java" 1

sudo update-alternatives --config java

And also register Firefox Java Plugin

sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" \
"mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.7.0_04/jre/lib/i386/libnpjp2.so" 1

sudo update-alternatives --config mozilla-javaplugin.so

ALL DONE. You can test your java install by

java -version

Here is a small screen capture of what happened on my screen when I went through above steps

Oracle JDK Install

Finally if you need to add JAVA_HOME variable, you can do so by adding it to the.bashrc file in your home directory

Open .bashrc file using an editor. If you use VI then
vi ~/.bashrc

and add the following 2 lines in your .bashrc file.

JAVA_HOME=/usr/lib/jvm/jdk1.7.0_04/
export JAVA_HOME

There may be other ways to install, but this is what I have followed always.

Cheers


'Programming > Java' 카테고리의 다른 글

sun java 설치  (0) 2012.05.01
Posted by 한효정

댓글을 달아 주세요


블로그 이미지
착하게 살자.
한효정

카테고리

공지사항

Yesterday0
Today1
Total25,756

달력

 « |  » 2019.11
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

최근에 달린 댓글

글 보관함