How to install and uninstall Java 7 in Solaris 11 x86?

0

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

user2416657

Posted 2013-06-18T08:08:56.267

Reputation: 11

1

Can this article help:http://www.oracle.com/technetwork/java/javase/install-solaris-64-138849.html ?

– duDE – 2013-06-18T08:22:30.747

Answers

2

pkg uninstall jdk-6
pkg install jdk-7

Note: There is no "Solaris 12" released.

jlliagre

Posted 2013-06-18T08:08:56.267

Reputation: 12 469

1Solaris 12--->my mistake – user2416657 – 2013-06-18T08:51:29.823

2

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:

jdk1.7.0_05
jdk1.7.0_09
jdk1.7.0_17
jdk1.7.0_67
jdk1.8.0_11
jdk7 -> jdk1.7.0_67
jdk8 -> jdk1.8.0_11
jre -> jre1.7.0_67
jre1.6.0_32
jre1.7.0_05
jre1.7.0_17
jre1.8.0_11
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.

thisisfun

Posted 2013-06-18T08:08:56.267

Reputation: 443

1

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@1.7.0.45

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.

SolarisGuy

Posted 2013-06-18T08:08:56.267

Reputation: 11