Skip to content

Instantly share code, notes, and snippets.

Created December 9, 2013 22:45
What would you like to do?
Setting alternatives for Oracle JDK on Linux.
# Setting alternatives for Oracle JDK
# check root permission
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
alternatives --install /usr/bin/java java $JAVA_BASE/bin/java 200000 \
--slave /usr/bin/keytool keytool $JRE_BIN/keytool \
--slave /usr/bin/orbd orbd $JRE_BIN/orbd \
--slave /usr/bin/pack200 pack200 $JRE_BIN/pack200 \
--slave /usr/bin/rmid rmid $JRE_BIN/rmid \
--slave /usr/bin/rmiregistry rmiregistry $JRE_BIN/rmiregistry \
--slave /usr/bin/servertool servertool $JRE_BIN/servertool \
--slave /usr/bin/tnameserv tnameserv $JRE_BIN/tnameserve \
--slave /usr/bin/unpack200 unpack200 $JRE_BIN/unpack200
alternatives --install /usr/bin/javac javac $JAVA_BASE/bin/javac 200000 \
--slave /usr/bin/appletviewer appletviewer $JDK_BIN/appletviewer \
--slave /usr/bin/apt apt $JDK_BIN/apt \
--slave /usr/bin/extcheck extcheck $JDK_BIN/extcheck \
--slave /usr/bin/idlj idlj $JDK_BIN/idlj \
--slave /usr/bin/jar jar $JDK_BIN/jar \
--slave /usr/bin/jarsigner jarsigner $JDK_BIN/jarsigner \
--slave /usr/bin/javadoc javadoc $JDK_BIN/javadoc \
--slave /usr/bin/javafxpackager javafxpackager $JDK_BIN/javafxpackager \
--slave /usr/bin/javah javah $JDK_BIN/javah \
--slave /usr/bin/javap javap $JDK_BIN/javap \
--slave /usr/bin/javaws javaws $JDK_BIN/javaws \
--slave /usr/bin/jcmd jcmd $JDK_BIN/jcmd \
--slave /usr/bin/jconsole jconsole $JDK_BIN/jconsole \
--slave /usr/bin/jcontrol jcontrol $JDK_BIN/jcontrol \
--slave /usr/bin/jdb jdb $JDK_BIN/jdb \
--slave /usr/bin/jhat jhat $JDK_BIN/jhat \
--slave /usr/bin/jinfo jinfo $JDK_BIN/jinfo \
--slave /usr/bin/jmap jmap $JDK_BIN/jmap \
--slave /usr/bin/jmap jmap $JDK_BIN/jmc \
--slave /usr/bin/jps jps $JDK_BIN/jps \
--slave /usr/bin/jrunscript jrunscript $JDK_BIN/jrunscript \
--slave /usr/bin/jsadebugd jsadebugd $JDK_BIN/jsadebugd \
--slave /usr/bin/jstack jstack $JDK_BIN/jstack \
--slave /usr/bin/jstat jstat $JDK_BIN/jstat \
--slave /usr/bin/jstatd jstatd $JDK_BIN/jstatd \
--slave /usr/bin/jvisualvm jvisualvm $JDK_BIN/jvisualvm \
--slave /usr/bin/native2ascii native2ascii $JDK_BIN/native2ascii \
--slave /usr/bin/policytool policytool $JDK_BIN/policytool \
--slave /usr/bin/rmic rmic $JDK_BIN/rmic \
--slave /usr/bin/schemagen schemagen $JDK_BIN/schemagen \
--slave /usr/bin/serialver serialver $JDK_BIN/serialver \
--slave /usr/bin/servertool servertool $JDK_BIN/servertool \
--slave /usr/bin/wsgen wsgen $JDK_BIN/wsgen \
--slave /usr/bin/wsimport wsimport $JDK_BIN/wsimport \
--slave /usr/bin/xjc xjc $JDK_BIN/xjc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment