Changing the Preferred Application

Use the pkg set-mediator command to reset the version of a specified mediation that is the default or preferred version.

Use the output from pkg mediator -a to select a version for the -V argument or an implementation for the -I argument. Do not specify a mediation participant that is not shown by pkg mediator -a.

Caution:

If you make a typographical error or otherwise specify a mediator version or implementation that is not currently available, any links that are managed by that mediator are removed as shown in Setting a Preferred Path that is Not Available: Consequences and Recovery.

Use the -n option with the set-mediator subcommand to see whether a backup BE will be created. If no backup BE will be created, you can specify the --require-backup-be option with the set-mediator subcommand. The mediator change is made in the current BE. When you have determined that your current BE has no problems after the mediator change, you can use beadm destroy to destroy the backup BE.

The following output shows that version 1.8 is the currently selected preferred version of the java mediation, and version 1.7 also is available in this image:

$ pkg mediator java
MEDIATOR VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION
java     system    1.8     system
$ pkg mediator -a java
MEDIATOR    VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION
java        system    1.8     system
java        system    1.7     system

The following command shows setting version 1.7 as the preferred version, which means that invoking /usr/bin/java will invoke JRE version 1.7. JRE version 1.8 is still available on the system when users specify the full path to that version. Compare the output of the two pkg mediator commands. When you changed the preferred version for the mediation, the VER. SRC. also changed to local, indicating that the selection was specified by an administrator. This selection will persist across reboots and package updates.

$ pkg set-mediator -v -V 1.7 java
            Packages to change:         3
           Mediators to change:         1
     Estimated space available: 867.06 GB
Estimated space to be consumed: 238.26 MB
       Create boot environment:        No
Create backup boot environment:       Yes
          Rebuild boot archive:        No
...
$ pkg mediator java
MEDIATOR VER. SRC. VERSION IMPL. SRC. IMPLEMENTATION
java     local     1.7     system

This administrative selection is retained across package updates, even if the selected implementation is no longer installed. If the selected implementation is no longer installed, the target of the mediated link does not exist. Use one of the following methods to reset the preferred implementation:

  • Use the pkg set-mediator command again to select a different implementation from the updated list shown by pkg mediator -a.

  • Use the pkg unset-mediator command to allow the system to select a new implementation.