While, after quite a few hours struggle, I finally addressed this annoying problem.
It seems that we can not rpm -ivh jdk-8u121-linux-x64.rpm
to directly install jdk, but download jdk-8u121-linux-x64.tar.gz
and untar it manually.
(Revised JW 1/8/2017) - you actually can directly install via rpm, via the following function
#//rpm install
rpm -ivh jdk-8u151-linux-x64.rpm
Most of the procedures can be found on this webpage, and just be cautious of the version of jdk you want to install.
Take jdk-8u121 x64 as example, I recommand switching to root cause otherwise there will be many sudo
:
1.Download jdk, choose jdk-8u121-linux-x64.tar.gz
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2.cd /path/to/downloaded/java
3.tar -xzf ./jdk-7uX-linux-XX.tar.gz
4.Open JDK is installed by default in /usr/lib64
, so let's move Oracle Java to /usr/lib64
as well:
mv ./jdk1.8.0_121/ /usr/lib64/
5.Create a symbolic link to /usr/lib64/jdk1.X.X_XX/
(this will be important later for updating):
ln -s -T /usr/lib64/jdk1.X.X_XX/ /usr/lib64/jdk_Oracle
6.Compress the man files involved in your installation:
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/java.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/keytool.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/orbd.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/policytool.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmid.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmiregistry.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/servertool.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/tnameserv.1)
7.Prepare the directory for jvm-exports, be cautious with version!
mkdir /usr/lib64/jvm-exports/jdk_Oracle
cd /usr/lib64/jvm-exports/jdk_Oracle
ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jaas-1.8.0_Orac.jar
ln -s jaas-1.8.0_Orac.jar jaas-1.8.0.jar
ln -s jaas-1.8.0_Orac.jar jaas.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/jce.jar jce-1.8.0_Orac.jar
ln -s jce-1.8.0_Orac.jar jce-1.8.0.jar
ln -s jce-1.8.0_Orac.jar jce.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jdbc-stdext-1.8.0_Orac.jar
ln -s jdbc-stdext-1.8.0_Orac.jar jdbc-stdext-1.8.0.jar
ln -s jdbc-stdext-1.8.0_Orac.jar jdbc-stdext-3.0.jar
ln -s jdbc-stdext-1.8.0_Orac.jar jdbc-stdext.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-1.8.0_Orac.jar
ln -s jndi-1.8.0_Orac.jar jndi-1.8.0.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-cos-1.8.0_Orac.jar
ln -s jndi-cos-1.8.0_Orac.jar jndi-cos-1.8.0.jar
ln -s jndi-cos-1.8.0_Orac.jar jndi-cos.jar
ln -s jndi-1.8.0_Orac.jar jndi.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-ldap-1.8.0_Orac.jar
ln -s jndi-ldap-1.8.0_Orac.jar jndi-ldap-1.8.0.jar
ln -s jndi-ldap-1.8.0_Orac.jar jndi-ldap.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar jndi-rmi-1.8.0_Orac.jar
ln -s jndi-rmi-1.8.0_Orac.jar jndi-rmi-1.8.0.jar
ln -s jndi-rmi-1.8.0_Orac.jar jndi-rmi.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/jsse.jar jsse-1.8.0_Orac.jar
ln -s jsse-1.8.0_Orac.jar jsse-1.8.0.jar
ln -s jsse-1.8.0_Orac.jar jsse.jar
ln -s /usr/lib64/jdk_Oracle/jre/lib/rt.jar sasl-1.8.0_Orac.jar
ln -s sasl-1.8.0_Orac.jar sasl-1.8.0.jar
ln -s sasl-1.8.0_Orac.jar sasl.jar
/usr/sbin/update-alternatives --install /usr/bin/java java /usr/lib64/jdk_Oracle/bin/java 3 --slave /usr/share/man/man1/java.1.gz java.1.gz /usr/lib64/jdk_Oracle/man/man1/java.1.gz --slave /usr/lib64/jvm/jre jre /usr/lib64/jdk_Oracle/jre --slave /usr/lib64/jvm-exports/jre jre_exports /usr/lib64/jvm-exports/jdk_Oracle --slave /usr/bin/keytool keytool /usr/lib64/jdk_Oracle/bin/keytool --slave /usr/share/man/man1/keytool.1.gz keytool.1.gz /usr/lib64/jdk_Oracle/man/man1/keytool.1.gz --slave /usr/bin/orbd orbd /usr/lib64/jdk_Oracle/bin/orbd --slave /usr/share/man/man1/orbd.1.gz orbd.1.gz /usr/lib64/jdk_Oracle/man/man1/orbd.1.gz --slave /usr/bin/policytool policytool /usr/lib64/jdk_Oracle/bin/policytool --slave /usr/share/man/man1/policytool.1.gz policytool.1.gz /usr/lib64/jdk_Oracle/man/man1/policytool.1.gz --slave /usr/bin/rmid rmid /usr/lib64/jdk_Oracle/bin/rmid --slave /usr/share/man/man1/rmid.1.gz rmid.1.gz /usr/lib64/jdk_Oracle/man/man1/rmid.1.gz --slave /usr/bin/rmiregistry rmiregistry /usr/lib64/jdk_Oracle/bin/rmiregistry --slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /usr/lib64/jdk_Oracle/man/man1/rmiregistry.1.gz --slave /usr/bin/servertool servertool /usr/lib64/jdk_Oracle/bin/servertool --slave /usr/share/man/man1/servertool.1.gz servertool.1.gz /usr/lib64/jdk_Oracle/man/man1/servertool.1.gz --slave /usr/bin/tnameserv tnameserv /usr/lib64/jdk_Oracle/bin/tnameserv --slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz /usr/lib64/jdk_Oracle/man/man1/tnameserv.1.gz
8.Compress the man files involved in your installation:
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/appletviewer.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/apt.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/extcheck.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jar.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jarsigner.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javac.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javadoc.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javah.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/javap.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jcmd.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jconsole.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jdb.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jhat.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jinfo.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jmap.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jps.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jrunscript.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jsadebugd.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jstack.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jstat.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/jstatd.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/native2ascii.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/pack200.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/rmic.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/schemagen.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/serialver.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/unpack200.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/wsgen.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/wsimport.1)
gzip $(readlink -f /usr/lib64/jdk_Oracle/man/man1/xjc.1)
/usr/sbin/update-alternatives --install /usr/bin/javac javac /usr/lib64/jdk_Oracle/bin/javac 3 \
--slave /usr/bin/appletviewer appletviewer /usr/lib64/jdk_Oracle/bin/appletviewer \
--slave /usr/share/man/man1/appletviewer.1.gz appletviewer.1.gz /usr/lib64/jdk_Oracle/man/man1/appletviewer.1.gz \
--slave /usr/bin/apt apt /usr/lib64/jdk_Oracle/bin/apt \
--slave /usr/share/man/man1/apt.1.gz apt.1.gz /usr/lib64/jdk_Oracle/man/man1/apt.1.gz \
--slave /usr/bin/extcheck extcheck /usr/lib64/jdk_Oracle/bin/extcheck \
--slave /usr/share/man/man1/extcheck.1.gz extcheck.1.gz /usr/lib64/jdk_Oracle/man/man1/extcheck.1.gz \
--slave /usr/bin/jar jar /usr/lib64/jdk_Oracle/bin/jar \
--slave /usr/share/man/man1/jar.1.gz jar.1.gz /usr/lib64/jdk_Oracle/man/man1/jar.1.gz \
--slave /usr/bin/jarsigner jarsigner /usr/lib64/jdk_Oracle/bin/jarsigner \
--slave /usr/share/man/man1/jarsigner.1.gz jarsigner.1.gz /usr/lib64/jdk_Oracle/man/man1/jarsigner.1.gz \
--slave /usr/lib64/jvm/java java_sdk /usr/lib64/jdk_Oracle \
--slave /usr/lib64/jvm-exports/java java_sdk_exports /usr/lib64/jvm-exports/jdk_Oracle \
--slave /usr/share/man/man1/javac.1.gz javac.1.gz /usr/lib64/jdk_Oracle/man/man1/javac.1.gz \
--slave /usr/bin/javadoc javadoc /usr/lib64/jdk_Oracle/bin/javadoc \
--slave /usr/share/man/man1/javadoc.1.gz javadoc.1.gz /usr/lib64/jdk_Oracle/man/man1/javadoc.1.gz \
--slave /usr/bin/javah javah /usr/lib64/jdk_Oracle/bin/javah \
--slave /usr/share/man/man1/javah.1.gz javah.1.gz /usr/lib64/jdk_Oracle/man/man1/javah.1.gz \
--slave /usr/bin/javap javap /usr/lib64/jdk_Oracle/bin/javap \
--slave /usr/share/man/man1/javap.1.gz javap.1.gz /usr/lib64/jdk_Oracle/man/man1/javap.1.gz \
--slave /usr/share/man/man1/jcmd.1.gz jcmd.1.gz /usr/lib64/jdk_Oracle/man/man1/jcmd.1.gz \
--slave /usr/bin/jconsole jconsole /usr/lib64/jdk_Oracle/bin/jconsole \
--slave /usr/share/man/man1/jconsole.1.gz jconsole.1.gz /usr/lib64/jdk_Oracle/man/man1/jconsole.1.gz \
--slave /usr/bin/jdb jdb /usr/lib64/jdk_Oracle/bin/jdb \
--slave /usr/share/man/man1/jdb.1.gz jdb.1.gz /usr/lib64/jdk_Oracle/man/man1/jdb.1.gz \
--slave /usr/bin/jhat jhat /usr/lib64/jdk_Oracle/bin/jhat \
--slave /usr/share/man/man1/jhat.1.gz jhat.1.gz /usr/lib64/jdk_Oracle/man/man1/jhat.1.gz \
--slave /usr/bin/jinfo jinfo /usr/lib64/jdk_Oracle/bin/jinfo \
--slave /usr/share/man/man1/jinfo.1.gz jinfo.1.gz /usr/lib64/jdk_Oracle/man/man1/jinfo.1.gz \
--slave /usr/bin/jmap jmap /usr/lib64/jdk_Oracle/bin/jmap \
--slave /usr/share/man/man1/jmap.1.gz jmap.1.gz /usr/lib64/jdk_Oracle/man/man1/jmap.1.gz \
--slave /usr/bin/jps jps /usr/lib64/jdk_Oracle/bin/jps \
--slave /usr/share/man/man1/jps.1.gz jps.1.gz /usr/lib64/jdk_Oracle/man/man1/jps.1.gz \
--slave /usr/bin/jrunscript jrunscript /usr/lib64/jdk_Oracle/bin/jrunscript \
--slave /usr/share/man/man1/jrunscript.1.gz jrunscript.1.gz /usr/lib64/jdk_Oracle/man/man1/jrunscript.1.gz \
--slave /usr/bin/jsadebugd jsadebugd /usr/lib64/jdk_Oracle/bin/jsadebugd \
--slave /usr/share/man/man1/jsadebugd.1.gz jsadebugd.1.gz /usr/lib64/jdk_Oracle/man/man1/jsadebugd.1.gz \
--slave /usr/bin/jstack jstack /usr/lib64/jdk_Oracle/bin/jstack \
--slave /usr/share/man/man1/jstack.1.gz jstack.1.gz /usr/lib64/jdk_Oracle/man/man1/jstack.1.gz \
--slave /usr/bin/jstat jstat /usr/lib64/jdk_Oracle/bin/jstat \
--slave /usr/share/man/man1/jstat.1.gz jstat.1.gz /usr/lib64/jdk_Oracle/man/man1/jstat.1.gz \
--slave /usr/bin/jstatd jstatd /usr/lib64/jdk_Oracle/bin/jstatd \
--slave /usr/share/man/man1/jstatd.1.gz jstatd.1.gz /usr/lib64/jdk_Oracle/man/man1/jstatd.1.gz \
--slave /usr/bin/native2ascii native2ascii /usr/lib64/jdk_Oracle/bin/native2ascii \
--slave /usr/share/man/man1/native2ascii.1.gz native2ascii.1.gz /usr/lib64/jdk_Oracle/man/man1/native2ascii.1.gz \
--slave /usr/bin/pack200 pack200 /usr/lib64/jdk_Oracle/bin/pack200 \
--slave /usr/share/man/man1/pack200.1.gz pack200.1.gz /usr/lib64/jdk_Oracle/man/man1/pack200.1.gz \
--slave /usr/bin/rmic rmic /usr/lib64/jdk_Oracle/bin/rmic \
--slave /usr/share/man/man1/rmic.1.gz rmic.1.gz /usr/lib64/jdk_Oracle/man/man1/rmic.1.gz \
--slave /usr/bin/schemagen schemagen /usr/lib64/jdk_Oracle/bin/schemagen \
--slave /usr/share/man/man1/schemagen.1.gz schemagen.1.gz /usr/lib64/jdk_Oracle/man/man1/schemagen.1.gz \
--slave /usr/bin/serialver serialver /usr/lib64/jdk_Oracle/bin/serialver \
--slave /usr/share/man/man1/serialver.1.gz serialver.1.gz /usr/lib64/jdk_Oracle/man/man1/serialver.1.gz \
--slave /usr/bin/unpack200 unpack200 /usr/lib64/jdk_Oracle/bin/unpack200 \
--slave /usr/share/man/man1/unpack200.1.gz unpack200.1.gz /usr/lib64/jdk_Oracle/man/man1/unpack200.1.gz \
--slave /usr/bin/wsgen wsgen /usr/lib64/jdk_Oracle/bin/wsgen \
--slave /usr/share/man/man1/wsgen.1.gz wsgen.1.gz /usr/lib64/jdk_Oracle/man/man1/wsgen.1.gz \
--slave /usr/bin/wsimport wsimport /usr/lib64/jdk_Oracle/bin/wsimport \
--slave /usr/share/man/man1/wsimport.1.gz wsimport.1.gz /usr/lib64/jdk_Oracle/man/man1/wsimport.1.gz \
--slave /usr/bin/xjc xjc /usr/lib64/jdk_Oracle/bin/xjc \
--slave /usr/share/man/man1/xjc.1.gz xjc.1.gz /usr/lib64/jdk_Oracle/man/man1/xjc.1.gz
9.Web browser plug-in
/usr/sbin/update-alternatives --install /usr/lib64/browser-plugins/javaplugin.so javaplugin /usr/lib64/jdk_Oracle/jre/lib/amd64/libnpjp2.so 3 --slave /usr/bin/javaws javaws /usr/lib64/jdk_Oracle/jre/bin/javaws --slave /usr/share/man/man1/javaws.1 javaws.1 /usr/lib64/jdk_Oracle/man/man1/javaws.1
10.Adding Java Control Panel
ln -s /usr/lib64/jdk_Oracle/jre/bin/jcontrol /usr/bin/
ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/hicolor/16x16/apps/sun-jcontrol.png /usr/share/icons/hicolor/16x16/apps/
ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/hicolor/48x48/apps/sun-jcontrol.png /usr/share/icons/hicolor/48x48/apps/
ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/LowContrast/16x16/apps/sun-jcontrol.png /usr/share/icons/locolor/16x16/apps/
ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/icons/LowContrast/48x48/apps/sun-jcontrol.png /usr/share/icons/locolor/48x48/apps/
ln -s /usr/lib64/jdk_Oracle/jre/lib/desktop/applications/sun_java.desktop /usr/share/applications
and, that's all!
more details on openSUSE Wiki