Install Java SDK 6.0 on Ubuntu 12.04

摘要:Install Java SDK 6.0 on Ubuntu 12.04

 

【Install Java SDK 6.0  on Ubuntu 12.04】 
 
http://www.gaggl.com/2012/04/installing-java6-jdk-on-ubuntu-12-04/
 
wget https://github.com/flexiondotorg/oab-java6/raw/0.2.1/oab-java6.sh -O oab-java6.sh
chmod +x oab-java6.sh
sudo ./oab-java6.sh
 
sudo apt-get purge sun-java
 
mkdir ~/src
cd ~/src
git clone https://github.com/flexiondotorg/oab-java6.git
cd ~/src/oab-java6
sudo ./oab-java.sh
 
sudo apt-get install sun-java6-plugin sun-java6-jre sun-java6-bin sun-java6-jdk
 
tail -f ~/src/oab-java6/oab-java.sh.log
 
--------------------------------------
[後記:2013.04.29]
在Ubuntu 12.04安裝Sun JAVA SDK時,
 
很多網路上介紹使用以下方式安裝
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy main multiverse"
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy-updates main multiverse"
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk

但卻在

sudo apt-get update

發生了

W: GPG error: http://ppa.launchpad.net precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2EA8F35793D8809A  

這個問題

 

又看了網路解

http://stanlearnslinux.blogspot.tw/2012/09/tech-review-linux-saturday-september-1.html

 

介紹了如下的指令

 

gpg --keyserver pgpkeys.mit.edu --recv-key 2EA8F35793D8809A
gpg -a --export 2EA8F35793D8809A | sudo apt-key add -
 
則fix了NO_PUBKEY 2EA8F35793D8809A的問題
 
但還是不能灌
 
出現了新的問題是
The following information may help to resolve the situation:
 
The following packages have unmet dependencies:
 sun-java6-jre : Depends: sun-java6-bin (>= 6.30-2~precise1) but 6.24-1build0.8.04.1 is to be installed or
                          ia32-sun-java6-bin (>= 6.30-2~precise1) but it is not going to be installed
                 Recommends: gsfonts-x11 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
 
又有一回答為
 
sun-java6-jre fails to install on my ia64 machine
 
所以,這下又頭痛了。
 
 
 
最後我放棄了,
決定去官網下載直接裝
 
照著做,會成功。
 
 
1.Download jdk-6u38-linux-x64.bin
http://www.oracle.com/technetwork/java/javase/downloads/jdk6u38-downloads-1877406.html
 
2. 設為可執行檔
chmod +x jdk-6u38-linux-x64.bin
3. 解開
./jdk-6u32-linux-x64.bin
4.建立jvm資料夾
sudo mkdir /usr/lib/jvm
5.移至jvm資料夾
sudo mv jdk1.6.0_38 /usr/lib/jvm/jdk1.6.0_38
6.設定環境變數吧(還是替換)
sudo update-alternatives –-install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_38/bin/javac 1
sudo update-alternatives –-install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_38/bin/java 1
sudo update-alternatives –-install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_38/bin/javaws 1
 
sudo update-alternatives –-config javac

sudo update-alternatives –-config javaws
sudo update-alternatives –-config java