Download Java for Opensolaris here. Choose your Platform "Solaris x86" or "Solaris x64". Select the "*.sh"-File and download it. Copy the File to /opt (Note: You will need Root-Priveleges):
host:# cp jdk-6u7-solaris-i586.sh /opt/
Now you can simply run the Shellscript:
host:/opt# sh jdk-6u7-solaris-i586.sh
The Script shows you the License for the JDK, you have to type "yes" (or "no") and the Installtion will go on and complete after a while.
Of Course, with Opensolaris and a fast Internet Connection you can use the Image Packaging System (IPS). But I don't know wich Java-Version is in the Repository.