The NetBeans IDE assumes that several versions of the IDE can be installed on a system at the same time. Also, Linux native packages of the NetBeans provide facility to run the NetBeans IDE from the command line. The Alternatives System give ability for a user to make choice of the IDE version that will be started after execution of the command netbeans.
Since netbeans.spec, revision 2.fc10 the Alternatives System is used in the NetBeans RPM for Fedora as a start point to run the NetBeans IDE from the command line.
The netbeans.spec contains the following code:
%define __alternatives %{_sbindir}/alternatives
%define nb_ netbeans
%define nb_ver 6.1
%define nb_alt_priority 610
%define nb_home %{_datadir}/%{nb_}
%define nb_dir %{nb_home}/%{nb_ver}
%define nb_bin_dir %{nb_dir}/bin
%define nb_launcher %{nb_bin_dir}/netbeans
...
%post
%{__alternatives} --install %{_bindir}/%{nb_} %{nb_} %{nb_launcher} %{nb_alt_priority}
%preun
if [ "$1" = "0" ]; then
%{__alternatives} --remove %{nb_} %{nb_launcher}
fi
$ netbeansTo get help use the command
$ netbeans --help
$ su - # alternatives --display netbeans netbeans - status is auto. link currently points to /usr/share/netbeans/6.1/bin/netbeans /usr/share/netbeans/6.1/bin/netbeans - priority 610 Current `best' version is /usr/share/netbeans/6.1/bin/netbeans.
$ man alternatives