4

I have searched many OpenSUSE forums for an answer to this, but so far I have not found one. Long story short, when installing the RPM for the JDK from Oracle, I receive the following:

> sudo zypper install jdk-8u111-linux-x64.rpm
[sudo] password for root:
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  jdk1.8.0_111

1 new package to install.
Overall download size: 158.3 MiB. Already cached: 0 B. After the operation, additional 258.5 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package jdk1.8.0_111-2000:1.8.0_111-fcs.x86_64           (1/1), 158.3 MiB (258.5 MiB unpacked)
Checking for file conflicts: ......................................................................[done]
(1/1) Installing: jdk1.8.0_111-2000:1.8.0_111-fcs.x86_64 ..........................................[done]
Additional rpm output:
Unpacking JAR files...
    tools.jar...
    plugin.jar...
    javaws.jar...
    deploy.jar...
    rt.jar...
    jsse.jar...
    charsets.jar...
    localedata.jar...
update-alternatives: using /usr/java/jdk1.8.0_111/jre/bin/java to provide /usr/bin/java (java) in auto mode
update-alternatives: error: alternative ControlPanel can't be slave of javac: it is a slave of java
warning: %post(jdk1.8.0_111-2000:1.8.0_111-fcs.x86_64) scriptlet failed, exit status 2

Forgive me for the high levels of verbosity, I just wanted you to see precisely as I see. This is on a fresh install of OpenSUSE Tumbleweed.

I have also tried to install it on OpenSUSE Leap 42.2 with a fresh install as well. After my very first attempt, I reloaded with no Java support whatsoever (no OpenJDK) to start from scratch as I've done with this install. I've followed the guides for installing Java on OpenSUSE specifically. Ones that have no Java installed, ones that java OpenJDK installed prior, ones that install both the JDK and JRE, for whatever reason, etc.

For the record, Java itself is functioning, but obviously the Control Panel is not. I have attempting manually use update-alternatives, I've attempted to compile from scratch, I've reloaded, I've switched from Leap to Tumbleweed. Here is some other information that may be of use:

> sudo update-alternatives --list java
/usr/java/jdk1.8.0_111/jre/bin/java
> sudo update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/java/jdk1.8.0_111/jre/bin/java
Nothing to configure.
> java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
> javac -version
javac 1.8.0_111

Again, I can see Java is working. But I'd still like to understand why this is so easily reproducible and how to fix it.

  • Have you tried following these directions? You have to add the manually-installed Java to the alternatives list. – Dan Jan 15 '17 at 4:22
  • Yes. I've followed them from top down, including the JRE and JDK. I've tried starting at the second section of just JDK. That page is actually where I started when I discovered I didn't have Oracle Java installed. – mrUlrik Jan 15 '17 at 4:29
  • And you replaced text with lib64 appropriately for 64-bit all throughout for every command? (not trying to be condescending, just checking) – Dan Jan 15 '17 at 7:06
  • No condensation interpreted! :D But yep, I did adapt to all version and architectures variables. – mrUlrik Jan 15 '17 at 13:13
4

The process of executing this install is easier than most think and surprisingly there is not much good or direct info out there on how to do this. The above answer is correct, but has some elements which are a bit outdated.

  1. Download Oracle JDK 1.8.0_151

    #// rpm Installation Oracle JDK 1.8.0_151
    wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"  http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.rpm
    
  2. Run installation command

    #// installation command
    rpm -ivh jdk-8u151-linux-x64.rp
    
  3. Verify the version is configured / installed to your prefernce

    java -version
    
  4. Set the environment variables using the command line interface or editor

    #//Command line 
    export JAVA_HOME=/usr/java/jdk1.8.0_151/
    export PATH=$PATH:/usr/java/jdk1.8.0_151/bin
    
    #// set variables at the END of the file etc/profile
    sudo vim /etc/profile/
    
    #//Variables to set within the file
    JAVA_HOME=/usr/java/jdk1.8.0_151
    PATH=$Path:$HOME/bin:@JAVA_HOME/bin
    export JAVA_HOME
    export PATH
    
    #//To save / exit vim execute the following key strokes
    <ESC>
    <:>
    <x>
    
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.