Software >> OS >> Unix >> Solaris >> Java >> How to install Java as a package

 

Use these instructions if you want to use the pkgadd utility to install the Solaris packages for the JDK. If you want to use the self-extracting binary file instead, see Installation of Self-extracting Binary above.

1. Download and check the file size to ensure that you have downloaded the full, uncorrupted software bundle.
 

It's best to create a new directory to save the download bundle to, as the next step will extract several directories and files into this directory. The directory can be anywhere you choose.

Before you download the file, notice its byte size provided on the download page on the web site. Once the download has completed, compare that file size to the size of the downloaded file to make sure they are equal.

2. Extract the contents of the compressed tar file:

On SPARC processors:
zcat jdk-1_5_0<update>-solaris-sparc.tar.Z | tar -xf -

On x86/AMD64/EM64T processors:
zcat jdk-1_5_0<update>-solaris-i586.tar.Z | tar -xf -

This creates several directories (SUNWj5rt, SUNWj5dev, SUNWj5cfg, SUNWj5man, SUNWj5dmo, and SUNWj5jmp) plus a few files in the current directory.

3. Become root by running su and entering the super-user password.

4. Uninstall any earlier 5.0 package installation of JDK.

If your machine has an earlier version of 5.0 already installed in the default location (/usr/jdk/jdk1.5.0), you must remove it before installing a later version of 5.0 at that location.

 

You can skip this step if you intend to install JDK 5.0 in a non-default location. For more details, see Selecting the Default Java Platform.

To uninstall the Solaris packages for JDK 5.0, remove them by running:

On all processors:
pkgrm SUNWj5rt SUNWj5dev SUNWj5cfg SUNWj5man SUNWj5dmo

 

5. Run the pkgadd command to install the packages.

 

On all processors:
pkgadd -d . SUNWj5rt SUNWj5dev SUNWj5cfg SUNWj5man SUNWj5dmo

This installs the JDK 5.0 into /usr/jdk/jdk1.5.0. Version 5.0 does not automatically become the default Java platform on Solaris 9 or earlier (unless there was no default), but does become the default on Solaris 10. If you want 5.0 to be the default on Solaris 8 or 9, follow the instructions at Default Installations of Java Platform.

See the pkgadd(1) and admin(4) man pages for information on installing the JDK in a non-default location.

 

6. For Japanese users: Install man pages.

If your machine has an earlier version of the 5.0 Japanese man pages already installed in /usr/jdk/jdk1.5.0, you must remove that package before installing a later version of the 5.0 Japanese man pages at that location. Remove this package by running:

 

On all processors:
pkgrm SUNWj5jmp

Then run the pkgadd command to install the new Japanese man page package:

On all processors:
pkgadd -d . SUNWj5jmp

 

7. Delete the tar files and extracted SUNW* directories.

8. Exit the root shell. No need to reboot.

References

[1]  http://java.sun.com/j2se/1.5.0/install-solaris.html