Go to the Java website, choose the JRE or JDK based on your platform and needs. Download the requisite .bin file and upload the file to the serveradmin home folder. For older versions of Java go to the Java Archives site.
Steps for JRE and JDK are both the same. Here is an example of a JDK setup,
If you try and install 32-bit Java on 64-bit Ubuntu you will get the following error,
This is because the ia32-libs package is missing,
Now 32-bit Java can be installed. To perform these actions, use the account that will be launching the Java process.
In this example, we are installing on a server and the account that uses the Java process is serveradmin.
The result will be an uncompressed jdk directory using the same name as the package. In this example the folder name would be, jdk1.6.0_22.
If you plan to use multiple versions of Java, we recommend keeping the folder name with the version number information and using symbolic links. If you are only using one version of Java, then simply rename the folder.
For the server example, we will rename the folder,