Unable to install Oracle Java 8 OpenSUSE 13.2

Hello all,

I need to install Oracle’s version of Java 8 on OpenSUSE 13.2.
This would seem to be a straightforward process however it is not turning out
to be. I have attempted to follow instructions found in the SUSE link here:
https://en.opensuse.org/SDB:Installing_Java#Situation but my results are not
the same. This is a fresh installation of OS13.2 with all recent updates.

The error I receive when trying to rpm -ivh the rpm is:

error: Failed dependencies:
/usr/sbin/alternatives is needed by jdk1.8.0_40-2000:1.8.0_40-fcs.i586

There is indeed no ‘alternatives’ in /usr/sbin. I assume it is looking for the command
update-alternatives or the driectory /etc/alternatives. I have tried linking to one or
the other but both result in the same error message. Ideas? I haven’t found this issue
anywhere else listed on a Google search, and for good measure I have wiped my VM
and re-installed but the same problem exists.

FWIW, if you try to force it with --nodeps it will unpack and sort of install but errors out with:

update-alternatives: error: alternative javaws can’t be slave of java: it is a slave of javaplugin
update-alternatives: error: alternative javaws can’t be slave of javac: it is a slave of javaplugin
warning: %post(jdk1.8.0_40-2000:1.8.0_40-fcs.i586) scriptlet failed, exit status 2

and the install will not be detected if you manually run update-alternatives --config java

Thanks.

Well did you install the alternatives package LOL

Just do a search for alternatives in yast Install that package. It allows using multi-versions of the same package or in this case java source,

Yep, it’s installed by default.

I have the same problem

/usr/sbin/alternatives…

don’t know what to do… I installed JDK via YaST, Eclipse works perfect.
But IntelliJ IDEA does’t work for me

Ok the package actually puts update-alternatives in the /usr/sbin . try making a link alternatives -> update-alternatives. I’m guessing a packaging problem

I have already tried this without success.

Sorry don’t have any further clue.

Create a script called **miuku.takes.no.responsibility.but.is.really.a.cute.guy.sh
**
and put inside it:


#!/bin/sh
priority=20000
jrebindir=/usr/java/jdk1.8.0_40/bin
jremandir=/usr/java/jdk1.8.0_40/man/man1
 /usr/sbin/update-alternatives --install \
 /usr/bin/java java $jrebindir/java $priority  \
--slave /usr/bin/ControlPanel ControlPanel $jrebindir/ControlPanel --slave /usr/bin/javaws javaws $jrebindir/javaws --slave /usr/bin/jcontrol jcontrol $jrebindir/jcontrol \
--slave /usr/bin/jjs jjs $jrebindir/jjs --slave /usr/bin/keytool keytool $jrebindir/keytool --slave /usr/bin/orbd orbd $jrebindir/orbd \
--slave /usr/bin/policytool policytool $jrebindir/policytool --slave /usr/bin/rmid rmid $jrebindir/rmid --slave /usr/bin/rmiregistry rmiregistry $jrebindir/rmiregistry \
--slave /usr/bin/servertool servertool $jrebindir/servertool --slave /usr/bin/tnameserv tnameserv $jrebindir/tnameserv \
--slave /usr/bin/javac javac $jrebindir/javac --slave /usr/bin/pack200 pack200 $jrebindir/pack200 \
--slave /usr/share/man/man1/java.1 java.1 $jremandir/java.1 \
--slave /usr/share/man/man1/javaws.1 javaws.1 $jremandir/javaws.1 --slave /usr/share/man/man1/jjs.1 jjs.1 $jremandir/jjs.1 \
--slave /usr/share/man/man1/keytool.1 keytool.1 $jremandir/keytool.1 --slave /usr/share/man/man1/orbd.1 orbd.1 $jremandir/orbd.1 \
--slave /usr/share/man/man1/pack200.1 pack200.1 $jremandir/pack200.1 --slave /usr/share/man/man1/policytool.1 policytool.1 $jremandir/policytool.1 \
--slave /usr/share/man/man1/rmid.1 rmid.1 $jremandir/rmid.1 --slave /usr/share/man/man1/rmiregistry.1 rmiregistry.1 $jremandir/rmiregistry.1 \
--slave /usr/share/man/man1/servertool.1 servertool.1 $jremandir/servertool.1 --slave /usr/share/man/man1/tnameserv.1 tnameserv.1 $jremandir/tnameserv.1 \
--slave /usr/share/man/man1/unpack200.1 unpack200.1 $jremandir/unpack200.1

Execute it and see what happens. If you have no openjdk installed but installed the .rpm from Oracle it should register it. **update-alternatives --config java **should reflect this.

Note, I pulled the priority and a few other things out of my butt so I take no responsibilty, however on my test VM:


java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)


java: /usr/bin/java /usr/lib64/java /etc/java /usr/share/java /usr/share/man/man1/java.1


lrwxrwxrwx 1 root root 22 Mar  5 19:04 /usr/bin/java -> /etc/alternatives/java
lrwxrwxrwx 1 root root 30 Mar  5 19:49 /etc/alternatives/java -> /usr/java/jdk1.8.0_40/bin/java

If you get errors about javac being master alternative, throw away your openjdk files as it gets confuzzled. Don’t have time to fix that right now :slight_smile:

With this much ‘munging’ with Java, where do you suspect I should locate my
unlimited strength JCE files? The JAVA environment is such a mess with links
everywhere.

Reinstalling OS so I can start clean.
Will take it up again tomorrow. Thanks
for the assistance.

Gave it one more shot before I left.
Reinstalled my VM clean.
Ran rpm -ivh --nodeps --force jdk-8u40-linux-586.rpm

Returns:

/var/tmp/rpm-tmp.P7xuNl: line 862: /usr/sbin/alternatives: No such file or directory
/var/tmp/rpm-tmp.P7xuNl: line 874: /usr/sbin/alternatives: No such file or directory
warning: %post(jdk1.8.0_40-2000:1.8.0_40-fcs.i586) scriptlet failed, exit status 127

next ran your script as:
./fixJDK8.sh

Returns:
update-alternatives: error: alternative javaws can’t be slave of java: it is a slave of javaplugin

Next run: update-alternatives --config java

Returns:

There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status

  • 0 /usr/lib/jvm/jre-1.8.0-openjdk/bin/java 18040 auto mode
    1 /usr/lib/jvm/jre-1.7.0-openjdk/bin/java 17147 manual mode
    2 /usr/lib/jvm/jre-1.8.0-openjdk/bin/java 18040 manual mode

Press enter to keep the current choice
[li], or type selection number:[/li]
No Oracle/Sun Java choice.

You ignored when I said you should get rid of openjdk files, meaning they need to be uninstalled. It’s because it doesn’t include the -devel files in my little fix script, I ran out of time and had to leave so it only included the jre files in the update alternatives.

The Oracle’s RPM is designed for Fedora/RHEL so it uses their alternatives script.

Don’t know if this will help, but while messing around with my Java installation today, I ran into similar problems. I found this set of instructions on some Chinese blog.


Download unzip JDK 7, giving 777 permission to use update-alternatives to manage multiple JDK:
sudo zypper install update-alternatives
sudo /usr/sbin/update-alternatives --install /usr/bin/java java /home/li/jdk1.7.0/bin/java 1065
sudo /usr/sbin/update-alternatives --install /usr/bin/javac javac /home/li/jdk1.7.0/bin/javac 1065
sudo /usr/sbin/ update-alternatives --install /usr/bin/jar jar /home/li/jdk1.7.0/bin/jar 1065
sudo /usr/sbin/update-alternatives --install /usr/bin/ javaws javaws /home/li/jdk1.7.0/bin/javaws 1065

Set the default JDK, enter a number to select:
sudo /usr/sbin/update-alternatives --config java
sudo /usr/sbin/update-alternatives --config javac

Set the environment variable:
vi ~/.bashrc
In the penultimate line to:
export JAVA_HOME=/home/li/jdk1.7.0

Save and then run:
source ~/.bashrc

I was installing just JRE so I didn’t need the javac, jar and javaws commands. I altered the commands to point to the appropriate locations where I had Java installed.

However, I still had some issues due to the non-standard location of my install, so I ended up dumping it and downloaded the one here:
http://software.opensuse.org/package/java-1_8_0-sun

which seemed to handle the update-alternatives business. But I still had to set up the $JAVA_HOME and $PATH variables to point to the selected Java install.

Once I got all that working, my jEdit text editor which is a Java app runs fine from the command line but doesn’t run from the KDE menu entry. I’ve got a post elsewhere on that problem.

Hope this helps.

Nope, didn’t ignore it. When you install Tomcat from the repos it forces installation of openJDK.
I’ll see if I can work around that.

Here is how I just installed 8u40 on 13.2:

  1. Don’t use the rpm but the tgz (jre-8u40-linux-x64.tar.gz) and untar it, e.g. to /usr/java (creates /usr/java/jre1.8.0_40/)
  2. Apply the std update-alternatives procedure, i.e.
    /usr/sbin/update-alternatives --install “/usr/bin/java” “java” “/usr/java/jre1.8.0_40/bin/java” 40
    /usr/sbin/update-alternatives --install “/usr/lib/browser-plugins/javaplugin.so” “javaplugin” “/usr/java/jre1.8.0_40/lib/amd64/libnpjp2.so” 40
    /usr/sbin/update-alternatives --config java
    /usr/sbin/update-alternatives --config javaplugin
  3. Finally, update symlink to plugin in appropriate user dir:
    cd .mozilla/plugins/
    rm libnpjp2.so
    ln -s /usr/java/jre1.8.0_40/lib/amd64/libnpjp2.so libnpjp2.so

Worked fine for me.
Regards Nick

Try this one:
https://sites.google.com/site/easylinuxtipsproject/java-for-opensuse

Always works for me, just be aware that the instructions are not yet for the latest java version, instead of jre1.8.0_31 you already download jre1.8.0_40

I’m seeing this same issue in SLES 11 SP3.

Does anyone know what the fix is to install the rpm?

Mostly commenting for subscription.

Thanks for that. I have it installed at this point using the package
from: **http://software.opensuse.org/package/java-1_8_0-sun

**First I de-installed openJDK 7 and 8 which are installed by default.
After de-installation I went back and marked the OpenJDK packages as ‘Taboo Never Install’ and
set Sun Java to ‘Protected’. I was then able to install Tomcat without it overwriting
the JDK.

Here is what I did on a SUSE 13.1 machine to make a rpm I installed
on SLES 11 SP3

use rpmrebuild
N.B. Make sure you are not root
set your favorite editor e.g.
setenv EDITOR xemacs
or
EDITOR=xemacs;export EDITOR

rpmrebuild -e -p jdk-8u40-linux-x64.rpm

wait it takes time to unpack everything.
before the editor opens

replace all alternatives with update-alternatives

save and exit the editor and wait because
it takes time to repack everything.

answer y when it asks if you want to continue

it should output where the rpm was saved to
e.g.
/usr/people/<your username>/rpmbuild/RPMS/x86_64/jdk1.8.0_40-1.8.0_40-fcs.x86_64.rpm

Some observations (and recommendations)

Looks like someone has cleaned up the SDB Java page since I looked at it (it was getting very cluttered).

I see that someone has also added some new content for Oracle SE 8.
I’ll take a close look at the new content to see if I can do the same for it that I did for Oracle SE 7 (create a few quick scripts) that not only fix the current situation that openJDK must be uninstalled (because like the original instructions for Oracle SE 7 point to the same binary name for both Oracle and openJDK causing a conflict).

If it’s not obvious, the current SDB Java has these sections…
“Java Runtime Environment Install using Oracle’s RPM”
Install Oracle JRE only (questionable value, not likely what a User would want)

“Java Development Kit installation using Oracle’s RPM”
Install Oracle using the RPM using the RPM command (I would rather use the zypper command instead).

“Procedure with development kit included (JDK)”
Instead of using the RPM, this uses the tar file. Also, references Oracle SE 7 so if you wanted to try this with Oracle SE 8, you’d have to modify. If you intend to install Oracle SE 7, you’d do better just to run my scripts which does everything in a few seconds
https://github.com/putztzu/openSUSE_Oracle_Java_Install

“Procedure with runtime environment only (JRE)”
This seems to be a tar version of the first section

Based on what I see in the current SDB, until I create some updated scripts for Oracle SE 8 (if possible)

  • If Oracle SE 7 is sufficient for your needs, I still recommend my scripts which installs Oracle SE 7 side by side with openJDK. It’s fast, and proven to work. All parts of the JDK are installed, although you may still have further work to do to enable and access the JDK parts.
  • If you want to install Oracle SE 8, only a JRE package can be found at software.opensuse.org. You can take your chances googling “opensuse java-1_8_0-sun-devel” for JDK packages
  • If you want to follow the SDB, in general the RPM instructions should be simpler than the TAR instructions but require close inspection before I can fully endorse.

I hope to be able to post some Oracle SE 8 scripts within the next week, but don’t hold me to it… :slight_smile:

TSU