Install Oracle (Sun) Java 6 on Ubuntu

來源:互聯網
上載者:User

全文來自:https://help.ubuntu.com/community/Java

Oracle (Sun) Java 6

WARNING: Oracle Java 6 had reached its end of life in November 2012. There is at least one severe known vulnerability in this version, and since Java 6 is neither supported by Canonical nor Oracle, there may be many more! You should really
not install this unless you have a specific need to do so. It is recommended that users either migrate to OpenJDK, or install Oracle Java 7.

Oracle (Sun) Java 6 is no longer available to be distributed by Ubuntu, because of license issues.

Deprecated information about the installation of Oracle Java 6:

JDK or JRE

Downloads the Java binary installers from Oracle, builds the .deb packages locally on your computer and then installs them.
Packages are compatible with the “official” Ubuntu ones and will upgrade Java 6 that was previously installed from packages.

You can find the script and full usage instructions on github.

  • https://github.com/flexiondotorg/oab-java6

(since version 0.2.3 it also works with java 7 using -7 optional parameter).

Another instruction it works for Ubuntu 12.04.

  • http://superuser.com/questions/353983/how-do-i-install-the-sun-java-sdk-in-ubuntu-11-10-oneric

Manual method

  • oracle java 6 jre 32-bit

 $ wget http://download.oracle.com/otn-pub/java/jdk/6u34-b04/jre-6u34-linux-i586.bin $ chmod u+x jre-6u34-linux-i586.bin $ ./jre-6u34-linux-i586.bin $ sudo mkdir -p /usr/lib/jvm $ sudo mv jre1.6.0_34 /usr/lib/jvm/ $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.6.0_34/bin/java" 1 $ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jre1.6.0_34/lib/i386/libnpjp2.so" 1 $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jre1.6.0_34/bin/javaws" 1

or

  • oracle java 6 jdk 32-bit

 $ wget http://download.oracle.com/otn-pub/java/jdk/6u34-b04/jdk-6u34-linux-i586.bin $ chmod u+x jdk-6u34-linux-i586.bin $ ./jdk-6u34-linux-i586.bin $ sudo mkdir -p /usr/lib/jvm $ sudo mv jdk1.6.0_34 /usr/lib/jvm/ $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_34/bin/java" 1 $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_34/bin/javac" 1 $ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_34/jre/lib/i386/libnpjp2.so" 1 $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jre1.6.0_34/bin/javaws" 1

  • IMPORTANT choose the java you installed as default

 $ sudo update-alternatives --config java $ sudo update-alternatives --config javac $ sudo update-alternatives --config mozilla-javaplugin.so $ sudo update-alternatives --config javaws

Choosing the default Java to use

If your system has more than one version of Java, configure which one your system uses by entering the following command in a terminal window

sudo update-alternatives --config java

This will present you with a selection that looks similar to the following (the details may differ for you):

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/jre1.7.0/jre/bin/java 3 manual mode  Press enter to keep the current choice[*], or type selection number: 1

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.