|Skip Navigation Links|
|Exit Print View|
|Adding and Updating Oracle Solaris 11.1 Software Packages Oracle Solaris 11.1 Information Library|
You might want to provide multiple versions of an application or tool in the same image. If the different versions of the application are delivered as part of the same mediation, then you can easily reset the version that is the default or preferred version. A mediation is a set of links to different implementations of an application, where each of the links has the same mediator name and the same link path but different target link paths.
Use the pkg mediator command to display all mediators in the image or display the current selected version of the specified mediator.
/usr/bin/pkg mediator [-aH] [-F format] [mediator ...]
Use the pkg set-mediator command to reset the version of a specified mediator that is the default or preferred version.
usr/bin/pkg set-mediator [-nv] [-I implementation] [-V version] [--no-be-activate] [--no-backup-be | --require-backup-be] [--backup-be-name name] [--deny-new-be | --require-new-be] [--be-name name] mediator ...
In the following example, two different versions of the Java Runtime Environment are installed.
$ pkg list 'runtime/java*' NAME (PUBLISHER) VERSION IFO runtime/java 188.8.131.52-0.175.1.0.0.18.1 i-- runtime/java/jre-6 184.108.40.206-0.175.1.0.0.18.1 i-- runtime/java/jre-7 220.127.116.11-0.175.1.0.0.18.0 i--
The following command shows that a java mediation is defined, and version 1.7 is the default version.
$ pkg mediator MEDIATOR VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION java system 1.7 system php system 5.2 system python vendor 2.6 vendor
The following command shows all java mediations that can be set. Both jre-6 and jre-7 define a symbolic link from /usr/bin/java. In the jre-6 package, the target of the /usr/bin/java link is jdk1.6. In the jre-7 package, the target of the /usr/bin/java link is jdk1.7. The previous command showed that version 1.7 is currently the target of the /usr/bin/java link. This mediation does not specify the preferred implementation, and the package system selected the implementation with the higher version as the preferred implementation.
$ pkg mediator -a java MEDIATOR VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION java system 1.7 system java system 1.6 system
The following command shows setting version 1.6 as the preferred implementation. This means that invoking /usr/bin/java will invoke JRE version 1.6. JRE version 1.7 is still available on the system when users specify the full path to that version. Compare the output of the two pkg mediator commands.
$ pkg mediator java MEDIATOR VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION java system 1.7 system $ pfexec pkg set-mediator -V 1.6 java Packages to update: 3 Mediators to change: 1 Create boot environment: No Create backup boot environment: No PHASE ITEMS Removing old actions 2/2 Updating modified actions 3/3 Updating image state Done Creating fast lookup database Done Reading search index Done Updating search index 3/3 $ pkg mediator java MEDIATOR VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION java local 1.6 system