2012年12月6日 星期四

安裝sun-java6-jdk失敗

當我安裝好ubuntu 12.04後 依照AOSP上的動作來設定環境時 當在安裝java jdk發生了錯誤
錯誤訊息如下:


Package sun-java6-jdk is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source
E: Package sun-java6-jdk has no installation candidate

 
解決方式可以參看 https://github.com/flexiondotorg/oab-java6
基本上步驟為

cd ~/
wget https://github.com/flexiondotorg/oab-java6/raw/0.2.6/oab-java.sh -O oab-java.sh
chmod +x oab-java.sh
sudo ./oab-java.sh
更正, 上述方法安裝後的java 6版本無法用來編譯android. 後來又google了一下後
其中ubuntu論壇上的參考網頁
https://help.ubuntu.com/community/Java

下述這個方法確定可用
安裝jdk6 # sudo add-apt-repository ppa:webupd8team/java # sudo apt-get update # sudo apt-get install oracle-java6-installer or 安裝jdk7 # sudo add-apt-repository ppa:webupd8team/java # sudo apt-get update # sudo apt-get install oracle-java7-installer
另外一開始其實有碰到安裝jdk7 failed的情況 錯誤訊息如下: dpkg: error processing oracle-java7-installer (--configure): subprocess installed post-installation script returned error exit status 1 No apport report written because MaxReports is reached already Errors were encountered while processing: oracle-java7-installer E: Sub-process /usr/bin/dpkg returned an error code (1)

解決方式就是先完全移除jdk, 移除方法如下
# sudo rm /var/lib/dpkg/info/oracle-java7-installer* # sudo apt-get purge oracle-java7-installer* # sudo rm /etc/apt/sources.list.d/*java* # sudo apt-get update
除除後再依照上述步驟重新安裝jdk就可以了

沒有留言:

張貼留言