<ubuntu 12.04 에서 jdk6 자동 설치법>
일부 검색 사이트에서는 install 시에 sun-java6-jdk 만 언급하는 경우만 있는데
다른 ubuntu 버전에서는 성공했을지 몰라도 12.04 에서는 에러가 발생한다.
찾아보니 sun-java6-plugin 도 같이 설치해줘야 한다.
1. 소스 설치
sudo add-apt-repository ppa:flexiondotorg/java
sudo apt-get update
sudo apt-get install sun-java6-jdk sun-java6-plugin
2. java vm 변경
sudo update-alternatives --config java
3. /etc/profile 수정해서 환경변수 설정
JAVA_HOME=/usr/lib/jvm/java-6-sun/
export JAVA_HOME
export PATH=$PATH:/usr/lib/jvm/java-6-sun/bin
4. 새로운 터미널창을 열어서 version 확인하기
java -version
javac -version
5. HelloJava.java 작성해서 실행확인하기
cat > HelloJava.java
class HelloJava{
public static void main(String args[]) {
System.out.println("Hello World");
}
}
원본글 주소
http://blog.naver.com/PostView.nhn?blogId=hrk007&logNo=60163302084
<ubuntu 12.04 에서 jdk6 수동 설치법>
Ubuntu GNU/Linux 12.04 LTS (Precise Pangolin) released. I wanted to manually install the Sun JDK 6 and 7 on Ubuntu.
Installing Sun JDK 6 on Ubuntu 12.04:
- Download the sun jdk 6 bin from here.
- Make the bin file executeable:
chmod +x jdk-6u32-linux-x64.bin
- Extract the bin file:
./jdk-6u32-linux-x64.bin
- Move extracted folder to this location:
sudo mv jdk1.6.0_32 /usr/lib/jvm/
- Install new java source in system:
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_32/bin/javac 1 sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_32/bin/java 1 sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_32/bin/javaws 1
- Choose default java:
sudo update-alternatives --config javac sudo update-alternatives --config java sudo update-alternatives --config javaws
- java version test:
java -version
- Verify the symlinks all point to the new java location:
ls -la /etc/alternatives/java*
- Enable Java plugin for Mozilla Firefox (even for Chrome)
#for 64-Bit jdk sudo ln -s /usr/lib/jvm/jdk1.6.0_32/jre/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins #for 32-Bit jdk sudo ln -s /usr/lib/jvm/jdk1.6.0_32/jre/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins
Installing Sun JDK 7 on Ubuntu 12.04:
- Download the sun jdk 7 tar file from here
- Extract the tar file:
tar -xvzf jdk-7u4-linux-x64.tar.gz
- Move extracted folder to this location:
sudo mv jdk1.7.0_04 /usr/lib/jvm/
- Install new java source in system:
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_04/bin/javac 1 sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_04/bin/java 1 sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_04/bin/javaws 1
- Choose default java:
sudo update-alternatives --config javac sudo update-alternatives --config java sudo update-alternatives --config javaws
- java version test:
java -version
- Verify the symlinks all point to the new java location:
ls -la /etc/alternatives/java*
- Enable Java plugin for Mozilla Firefox (even for Chrome)
#for 64-Bit jdk sudo ln -s /usr/lib/jvm/jdk1.7.0_04/jre/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins #for 32-Bit jdk sudo ln -s /usr/lib/jvm/jdk1.7.0_04/jre/lib/i386/libnpjp2.so /usr/lib/mozilla/plugins
Update: I have added Java Web Start configuration (Thanks Jack).
Update: I have added Java Plugin configuration for Mozilla Firefox even for Chrome (Thanks shetty).
Update: JAVA_HOME configuration: Some tools require JAVA_HOME variable. You can set JAVA_HOME in Ubuntu so simple: Edit the file .bashrc under your home directory and add the following lines: (if .bashrc is hidden click in Nautilus Menu View > Show Hidden Files)
export JAVA_HOME=/path/your/jdk export PATH=$JAVA_HOME/bin:$PATH
source site : http://www.devsniper.com/ubuntu-12-04-install-sun-jdk-6-7/
'시스템 > linux' 카테고리의 다른 글
gcc thread complie undefined reference to `pthread_create' (0) | 2012.11.13 |
---|---|
우분투 root 비밀 번호 리셋 (0) | 2012.11.06 |
ubuntu 10.04 sun-java6-jdk 설치 (0) | 2012.09.28 |
DDNS를 지원하지않을때 리눅스에 ddclient 프로그램 설치 (0) | 2011.09.21 |
Webalizer 설치법 (0) | 2011.09.19 |