Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to uninstall java jdk6 and jre6 from Solaris 11 x86 OS? and install java7? How to set the path and class path?

share|improve this question
Can this article… ? – duDE Jun 18 '13 at 8:22
pkg uninstall jdk-6
pkg install jdk-7

Note: There is no "Solaris 12" released.

share|improve this answer
Solaris 12--->my mistake – user2416657 Jun 18 '13 at 8:51

Personally I've found it best not to touch the Java that is used by the OS. Let it live its own life.

I simply install the tar.gz packages from Oracle's Java Download Site into a directory e.g. /java. The downside is that this way I'm not using the packaging mechanism (IPS) but on the other hand it allows me full control and I can have as many JREs or JDKs installed as I want. If you are using the tar.gz packages you are not really installing, you are really just unpacking an archive into a directory. I like this for its simplicity and because it be definition is not intrusive.

As an example my /java directory looks like this:

jdk7 -> jdk1.7.0_67
jdk8 -> jdk1.8.0_11
jre -> jre1.7.0_67
jre6 -> jre1.6.0_32
jre7 -> jre1.7.0_67
jre8 -> jre1.8.0_11

In other words: Lots of directories that represent JREs or JDKs I've installed (read: unpacked) over the years. The directory names actually create themselves when you unpack. As you can see I use symbolic links to centralize version handling.

If I have an application which I would like to use JRE7 then I would simply make sure that I set the PATH variable appropriately before the application is launched. Say for example:

export PATH="/java/jre7/bin:${PATH}"

This will make sure my application uses Java 7.

You ask also about classpath. That question has nothing to do with the java core. Once you've set your PATH correctly then Java automatically knows where to find its core jar files. The reason you typically need to set classpath is because of your application's own requirement, not because of the Java runtime environment.

share|improve this answer

You cannot remove the JDK/JRE that the OS applications are using. Period. But you can

  1. upgrade or downgrade it
  2. install/remove a newer family version

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://solaris/runtime/java/jre-7@

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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .