Hi java-on-opensuse fellows,

I have created the following script to create an alternatives java and javac directly from the installed SUN JDK rpm.

It contains some guesswork and I would be happy to have someone point out issues that I have introduced.

After creating the script, I can use update-alternatives --config java or javac and switch to the most current SUN implementation.

I needed this because I have not been able to install myeclipseIDE with the openJDK implementation in OpenSUSE11.1 due to the lack of SSL implementation classes.

OpenSuse offers only outdated versions of SUN JDK (at least the x64 versions), so I took the task to give update-alternatives a try.

After switching to this java version, installation worked as expected.

Have fun,


Thomas


> cut here 8<--------------------------------------

export NEWJDK=/usr/java/jdk1.6.0_16/
export NEWJDK_MAN=/usr/java/jdk1.6.0_16/man/


update-alternatives --verbose --install /usr/bin/javac javac ${NEWJDK}bin/javac 20000 \
--slave java_sdk java_sdk ${NEWJDK} \
--slave java_sdk_exports java_sdk_exports /usr/lib64/jvm-exports/java-1.6.0-sun \
--slave /usr/bin/javah javah ${NEWJDK}/bin/javah \
--slave /usr/bin/jrunscript jrunscript ${NEWJDK}bin/jrunscript \
--slave /usr/bin/jinfo jinfo ${NEWJDK}bin/jinfo \
--slave /usr/bin/jconsole jconsole ${NEWJDK}bin/jconsole \
--slave /usr/bin/native2ascii native2ascii ${NEWJDK}bin/native2ascii \
--slave /usr/bin/apt apt ${NEWJDK}bin/apt \
--slave /usr/bin/jhat jhat ${NEWJDK}bin/jhat \
--slave /usr/bin/jdb jdb ${NEWJDK}bin/jdb \
--slave /usr/bin/wsimport wsimport ${NEWJDK}bin/wsimport \
--slave /usr/bin/extcheck extcheck ${NEWJDK}bin/extcheck \
--slave /usr/bin/serialver serialver ${NEWJDK}bin/serialver \
--slave /usr/bin/javadoc javadoc ${NEWJDK}bin/javadoc \
--slave /usr/bin/jarsigner jarsigner ${NEWJDK}bin/jarsigner \
--slave /usr/bin/jmap jmap ${NEWJDK}bin/jmap \
--slave /usr/bin/wsgen wsgen ${NEWJDK}bin/wsgen \
--slave /usr/bin/jps jps ${NEWJDK}bin/jps \
--slave /usr/bin/jstat jstat ${NEWJDK}bin/jstat \
--slave /usr/bin/rmic rmic ${NEWJDK}bin/rmic \
--slave /usr/bin/schemagen schemagen ${NEWJDK}bin/schemagen \
--slave /usr/bin/jstatd jstatd ${NEWJDK}bin/jstatd \
--slave /usr/bin/xjc xjc ${NEWJDK}bin/xjc \
--slave /usr/bin/jstack jstack ${NEWJDK}bin/jstack \
--slave /usr/bin/appletviewer appletviewer ${NEWJDK}bin/appletviewer \
--slave /usr/bin/jsadebugd jsadebugd ${NEWJDK}bin/jsadebugd \
--slave /usr/bin/jar jar ${NEWJDK}bin/jar \
--slave /usr/bin/javap javap ${NEWJDK}bin/javap \
--slave /usr/bin/HtmlConverter HtmlConverter ${NEWJDK}bin/HtmlConverter \
--slave /usr/bin/idlj idlj ${NEWJDK}bin/idlj \
--slave /usr/bin/jcontrol jcontrol ${NEWJDK}bin/jcontrol \
--slave /usr/bin/jvisualvm jvisualvm ${NEWJDK}bin/jvisualvm \
--slave /usr/share/man/man1/jstack.1.gz jstack.1.gz ${NEWJDK_MAN}man1/jstack.1.gz \
--slave /usr/share/man/man1/native2ascii.1.gz native2ascii.1.gz ${NEWJDK_MAN}man1/native2ascii.1.gz \
--slave /usr/share/man/man1/javadoc.1.gz javadoc.1.gz ${NEWJDK_MAN}man1/javadoc.1.gz \
--slave /usr/share/man/man1/jstatd.1.gz jstatd.1.gz ${NEWJDK_MAN}man1/jstatd.1.gz \
--slave /usr/share/man/man1/jstat.1.gz jstat.1.gz ${NEWJDK_MAN}man1/jstat.1.gz \
--slave /usr/share/man/man1/schemagen.1.gz schemagen.1.gz ${NEWJDK_MAN}man1/schemagen.1.gz \
--slave /usr/share/man/man1/jinfo.1.gz jinfo.1.gz ${NEWJDK_MAN}man1/jinfo.1.gz \
--slave /usr/share/man/man1/javap.1.gz javap.1.gz ${NEWJDK_MAN}man1/javap.1.gz \
--slave /usr/share/man/man1/jarsigner.1.gz jarsigner.1.gz ${NEWJDK_MAN}man1/jarsigner.1.gz \
--slave /usr/share/man/man1/jrunscript.1.gz jrunscript.1.gz ${NEWJDK_MAN}man1/jrunscript.1.gz \
--slave /usr/share/man/man1/xjc.1.gz xjc.1.gz ${NEWJDK_MAN}man1/xjc.1.gz \
--slave /usr/share/man/man1/wsimport.1.gz wsimport.1.gz ${NEWJDK_MAN}man1/wsimport.1.gz \
--slave /usr/share/man/man1/serialver.1.gz serialver.1.gz ${NEWJDK_MAN}man1/serialver.1.gz \
--slave /usr/share/man/man1/apt.1.gz apt.1.gz ${NEWJDK_MAN}man1/apt.1.gz \
--slave /usr/share/man/man1/rmic.1.gz rmic.1.gz ${NEWJDK_MAN}man1/rmic.1.gz \
--slave /usr/share/man/man1/jconsole.1.gz jconsole.1.gz ${NEWJDK_MAN}man1/jconsole.1.gz \
--slave /usr/share/man/man1/jmap.1.gz jmap.1.gz ${NEWJDK_MAN}man1/jmap.1.gz \
--slave /usr/share/man/man1/appletviewer.1.gz appletviewer.1.gz ${NEWJDK_MAN}man1/appletviewer.1.gz \
--slave /usr/share/man/man1/jps.1.gz jps.1.gz ${NEWJDK_MAN}man1/jps.1.gz \
--slave /usr/share/man/man1/jsadebugd.1.gz jsadebugd.1.gz ${NEWJDK_MAN}man1/jsadebugd.1.gz \
--slave /usr/share/man/man1/jhat.1.gz jhat.1.gz ${NEWJDK_MAN}man1/jhat.1.gz \
--slave /usr/share/man/man1/javah.1.gz javah.1.gz ${NEWJDK_MAN}man1/javah.1.gz \
--slave /usr/share/man/man1/jar.1.gz jar.1.gz ${NEWJDK_MAN}man1/jar.1.gz \
--slave /usr/share/man/man1/wsgen.1.gz wsgen.1.gz ${NEWJDK_MAN}man1/wsgen.1.gz \
--slave /usr/share/man/man1/jdb.1.gz jdb.1.gz ${NEWJDK_MAN}man1/jdb.1.gz \
--slave /usr/share/man/man1/javac.1.gz javac.1.gz ${NEWJDK_MAN}man1/javac.1.gz \
--slave /usr/share/man/man1/extcheck.1.gz extcheck.1.gz ${NEWJDK_MAN}man1/extcheck.1.gz \


update-alternatives --verbose --install /usr/bin/java java ${NEWJDK}jre/bin/java 20000 \
--slave jre jre ${NEWJDK}jre \
--slave jre_exports jre_exports /usr/lib64/jvm-exports/jre-1.6.0-sun \
--slave /usr/bin/ControlPanel ControlPanel ${NEWJDK}bin/ControlPanel \
--slave /usr/bin/rmid rmid ${NEWJDK}jre/bin/rmid \
--slave /usr/bin/unpack200 unpack200 ${NEWJDK}jre/bin/unpack200 \
--slave /usr/bin/javaws javaws ${NEWJDK}jre/bin/javaws \
--slave /usr/bin/policytool policytool ${NEWJDK}jre/bin/policytool \
--slave /usr/bin/orbd orbd ${NEWJDK}jre/bin/orbd \
--slave /usr/bin/rmiregistry rmiregistry ${NEWJDK}jre/bin/rmiregistry \
--slave /usr/bin/tnameserv tnameserv ${NEWJDK}jre/bin/tnameserv \
--slave /usr/bin/pack200 pack200 ${NEWJDK}jre/bin/pack200 \
--slave /usr/bin/keytool keytool ${NEWJDK}jre/bin/keytool \
--slave /usr/bin/servertool servertool ${NEWJDK}jre/bin/servertool \
--slave /usr/share/man/man1/keytool.1.gz keytool.1.gz ${NEWJDK_MAN}man1/keytool.1.gz \
--slave /usr/share/man/man1/rmid.1.gz rmid.1.gz ${NEWJDK_MAN}man1/rmid.1.gz \
--slave /usr/share/man/man1/orbd.1.gz orbd.1.gz ${NEWJDK_MAN}man1/orbd.1.gz \
--slave /usr/share/man/man1/unpack200.1.gz unpack200.1.gz ${NEWJDK_MAN}man1/unpack200.1.gz \
--slave /usr/share/man/man1/servertool.1.gz servertool.1.gz ${NEWJDK_MAN}man1/servertool.1.gz \
--slave /usr/share/man/man1/pack200.1.gz pack200.1.gz ${NEWJDK_MAN}man1/pack200.1.gz \
--slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz ${NEWJDK_MAN}man1/rmiregistry.1.gz \
--slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz ${NEWJDK_MAN}man1/tnameserv.1.gz \
--slave /usr/share/man/man1/java.1.gz java.1.gz ${NEWJDK_MAN}man1/java.1.gz \
--slave /usr/share/man/man1/policytool.1.gz policytool.1.gz ${NEWJDK_MAN}man1/policytool.1.gz

===8<------------------------------------------------