reference: 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.
(since version 0.2.3 it also works with java 7 using -7 optional parameter).
Another instruction it works for Ubuntu 12.04.
Manual method
$ 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
$ wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin
$ chmod u+x jdk-6u45-linux-x64.bin
$ ./jdk-6u45-linux-x64.bin
$ sudo mv jdk1.6.0_45 /opt
$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.6.0_45/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/jdk1.6.0_45/bin/javac" 1
$ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/opt/jdk1.6.0_45/jre/lib/amd64/libnpjp2.so" 1
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/jdk1.6.0_45/bin/javaws" 1
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
Optionally you can set a JAVA_HOME env variable:
export _JAVA_HOME=/opt/jdk1.6.0_45/
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
IBM Java
IBM provide JRE and SDK binaries for a number of architectures, including PowerPC. These are available via the
IBM Downloads Page once you have registered.
There
are two types of 'InstallAnywhere' package available to you: the
'Archive/tgz' only extracts the files to your system, whereas the
'Installable' package supposedly also configures your system. You can
use either, both require additional configuration with Ubuntu. The
'Installable' package also provides an uninstall option.
To run the downloaded file use the following commands:
chmod a+x ibm-java-ppc-jre-6.0-10.1.bin
sudo ./ibm-java-ppc-jre-6.0-10.1.bin
This
launches an interactive program that guides you through the
installation options. Extract the file to the directory of your choice
(for example /usr/lib/jvm/java-6-ibm-powerpc).
Once
completed, you then need to tell the system where to find the new java
commands. If you only have IBM Java installed then you can define an
environment variable to do this. For example, add the following line to your .bashrc file in your home directory.
export PATH=/usr/lib/jvm/java-6-ibm-powerpc/bin:/usr/lib/jvm/java-6-ibm-powerpc/jre/bin:$PATH
If you also have openjdk installed then you'll need to update the java alternatives:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-6-ibm-powerpc/jre/bin/java" 1
sudo update-alternatives --set java /usr/lib/jvm/java-6-ibm-powerpc/jre/bin/java
You'll need to repeat this for every command you need. For the mozilla plugin you can use:
sudo update-alternatives --install /usr/lib/mozilla/plugins/mozilla-javaplugin.so mozilla-javaplugin.so /usr/lib/jvm/java-6-ibm-powerpc/jre/lib/ppc/libnpjp2.so 1
sudo update-alternatives --config mozilla-javaplugin.so
Further guidance can be found in the
IBM documentation (including a different way to link the plugin).
If
you don't use the mozilla plugin frequently then you can disable it for
security. You can do this through the Firefox menus or there are
Firefox extensions you can use to automate this.
To control which Java the Konqueror web browser uses, go to your KDE system settings. Select Internet & Network -> Web Browser -> Java & JavaScript, and change the Path to Java executable to either /usr/lib/jvm/java-6-ibm-powerpc/bin/java or java (without any quotes).
Test the installation at the Sun Java
test webpage and using the command:
Note, there are old PowerPC deb packages still in
medibuntu
(keep clicking refresh if you get 403 forbidden). These are probably
the easiest way to install, although they are now lacking security
updates, plus the latest browser plugin. For these reasons it is
strongly advised that you download a newer
Service Refresh Fix Pack directly from the
IBM Downloads Page.
You may have to install libstdc++5 and libgtk1.2
packages to use old versions of IBM Java. If you installed a 1.4.2
version, and your processor is not a G5, you may have to perform another
step to get it to work. For a G3 or G4, use the following command:
sudo sh -c 'echo "JITC_PROCESSOR_TYPE=6" >> /etc/environment'
For a 604e or 603e, instead use:
sudo sh -c 'echo "JITC_PROCESSOR_TYPE=5" >> /etc/environment'