Update 2011: see my updated answer: no more sudo pkgadd
necessary.
First answer in 2009:
There are two methods for installing a JDK:
- Self-extracting binary (shell script)
- Solaris packages (
pkgadd
command)
Since the Self-extracting binary is not meant to be configured to install in non-standard path, I would recommend the later one (packages).
You need to download:
- jdk-6u16-solaris-sparc.tar.Z (main package, used for 32-bits installation)
- jdk-6u16-solaris-sparcv9.tar.Z (small package, used for 64-bits additional-step installation)
Since the content extraction of those compressed archives creates files directly in the current directory, I would advise moving each archive in its dedicated repository
$ mkdir jdk-6u16-solaris-sparc
$ mv jdk-6u16-solaris-sparc.tar.Z jdk-6u16-solaris-sparc
$ cd jdk-6u16-solaris-sparc
$ zcat jdk-6<update>-solaris-sparc.tar.Z | tar -xf -
$ cd ..
$ mkdir jdk-6u16-solaris-sparcv9
$ mv jdk-6u16-solaris-sparcv9.tar.Z jdk-6u16-solaris-sparcv9
$ cd jdk-6u16-solaris-sparcv9
$ zcat jdk-6<update>-solaris-sparcv9.tar.Z | tar -xf -
What is not mentioned in the documentation is the case when you need a local installation (in a local zone), separate from a global JDK already installed in /usr/java
(/usr
is not writable from a local zone).
the '-R
' option of pkgadd comes in handy in this case.
$ cd jdk-6u16-solaris-sparc
$ sudo pkgadd -R /MY_REP -d . SUNWj6rt SUNWj6dev SUNWj6cfg SUNWj6man SUNWj6dmo
$ cd ../jdk-6u16-solaris-sparcv9
$ sudo pkgadd -R /MY_REP -d . SUNWj6rtx SUNWj6dvx SUNWj6dmx
Here JDK6 is installed under:
/MY_REP/usr/jdk/instances/jdk1.6.0
/MY_REP/usr/java -> jdk/jdk1.6.0_16/
/MY_REP/usr/jdk/jdk1.6.0_16 -> instances/jdk1.6.0/
No need to "root shell" (which is 'evil' anyway) as mentioned by the Sun documentation:
a 'sudo root pkgadd
' is enough.