How to uninstall java jdk6 and jre6 from Solaris 11 x86 OS? and install java7? How to set the path and class path?
Note: There is no "Solaris 12" released.
You cannot remove the JDK/JRE that the OS applications are using. Period. But you can
for example in Solaris 11/11 the OS has JRE6 and several apps installed rely on JRE6. You CANNOT remove it. You can update it to a higher version of 6. In this case you can also install or remove JRE7 or 8 with IPS. Adding only JRE7 does not change the applictions that are still reliant on JRE6.
If you update the OS (such as "pkg update --accept") this will likely update all the apps that rely on the JRE as well. Now you have them all rely on say JRE7. When this happens you can no longer remove 7 (which the update installed), but you can update it to a higher version of 7. You can also install/uninstall JRE8 since it is not tied to the system.
This is true for whatever version of Solaris 11 and up (yes 12 also) you have.
By the way to downgrade the JRE you update it - you point to a prior version and update to that version. If you have a repository that has say 7u45 and 7u60, when you updated you have 7u60. If you want to go back to 7u45 you specify it like this
pkg update pkg://firstname.lastname@example.org
By the way installing SVR4 packages (pkgadd) on Solaris 11 and up for Java is NOT supported. IPS is the preferred and supported way to put Java on your system. If you need multiple family versions, one should use the .gz or other compressed bundles and drop it in a custom location.