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
Ok the package actually puts update-alternatives in the /usr/sbin . try making a link alternatives -> update-alternatives. I’m guessing a packaging problem
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
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.
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).
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.
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.
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
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
**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.
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…