SDB Talk:Installing Java
Please clean up this article
Installing Oracle JDK should not be more complicated than installing the RPM and setting up alternatives. Someone please remove the remainder of the article.
Discussion about JRE from Oracle
I used this article to install JDK on an ARM system, for which there is only a tar.gz version. So needed to use the instructions for installation of such installation file. One of these instruction contains a call with update-alternatives and a lot of --slave lines, each line ending with a \ to continue on the next line. However apparently the buffer was not large enough, so only part of the command was done. There is no instruction how to split this one command in two or more commands. Can this be added?--Fdekruijf (talk) 20:56, 17 September 2013 (UTC)
Comment by TSU2 4.02.2014
During my major revamp (see my later comment) I ran into these issues and addressed.
- You'll notice below I opted for the RPM and the reasons why
- The update-alternatives, particularly with a <very> large number of --slave lines is not actually limited by the max length if you paste into a console (apparently there is a file max length which does not apply to console stdin but there <may> be a buffer limit) or by file (My script install proves this. Might be close, but will work). But, also the update-alternatives MAN describes how you can re-run the command with different arguments (eg. --slave) and the new arguments will append if the command and group already exist. But, just use my script and you'll be happy.
Some minor edit
I have added "plugin=$(rpm -ql jre | grep libnpjp2.so) && ln -svf "$plugin" /path/to/plugin" in this article because different jre version or different openSUSE version might change the location of libnpjp2.so. For example 13.1 it is not on the same place as the previous 12.3 release. That code will make sure it finds that plugin. The removal of the previous existing symlink via rm is not needed, the -f option fom ln will take care of that. The && will make sure ln will ONLY run/executed if libnpjp2.so does exists in the jre rpm package. Note that ln will not error out on you even if the file you are linking does not exist!!!.
Options of ln are:
- -s, --symbolic make symbolic links instead of hard links
- -v, --verbose print name of each linked file
- -f, --force remove existing destination files
last edit by Jetchisel Mon Oct 6 23:01:08 UTC 2014
I've created a script with the necessary commands
Rudimentary, but worked for me on OpenSuse 13.1 64 bit
Available at this GitHub repo
Maintainers of this page: adopt something like the provided script above, or... something! But the long update-alternatives line with hundreds of hardcoded jdk1.8.0_05, well, you can't be serious. That was a joke, right? --Miguelfreitas (talk) 18:49, 4 January 2015 (UTC)
Web Plugin section insufficient
The instructions are at this Oracle link
http://www.oracle.com/technetwork/java/javase/manual-plugin-install-linux-136395.html
what seems to be insufficient?
Scripts to Install JDK and major improvements
I will offer these scripts to this SDB after a period of testing.
https://github.com/putztzu/openSUSE_Oracle_Java_Install
I opted for significant changes compared to this original SDB
- Based on RPM install instead of TAR. The original SDB describes removing openJDK before installing Oracle Java. One of the main reason to use update-alternatives is to switch between installed versions. For this reason I <did not> copy the Oracle Java files into /usr/lib* to remove any possibility of library contention/collision and only symlinked to /usr/lib* as described in the SDB
- removed use of "sudo" which is not in the spirit of openSUSE. All scripts should be run from within a root console.
- retained separate scripts for each major step to retain maintenance flexibility and clarity for troubleshooting
- replaced the commands to manually gzip the MAN files and symlink creation with a little program. The original code in the SDB left several MAN pages un-gzipped for whatever reason, but my program gzips all JDK MAN pages whether they are critical to the installation or not, and if pages are added in the future.
As of now, I believe the scripts I created for x64 and i586 should work fine on any version of 32bit or 64bit openSUSE currently and into the future, adjusting only for the specific version of Oracle JDK to be installed.
The scripts install these parts of the JDK
JRE
javac
Currently does not install the Java Control Panel (unknown issues at the moment) and the Java Web Plugin (see my comment in this discussion immediately preceding).
Slave Error Not Covered
For the last several versions of OpenSuSE and of Java, when I've tried to install the JDK RPM, the installation fails with the message following, or similar:
- 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_111-2000:1.8.0_111-fcs.x86_64) scriptlet failed, exit status 2
To me, it seems so common that it should be addressed in this article. --Huff-N-Puff (talk) 03:00, 19 December 2016 (UTC)
- Instead of documenting known bugs (and this really looks like a bug), it's a better idea to get them fixed. So please head over to bugzilla.opensuse.org and open a bugreport ;-) --Cboltz (talk) 18:56, 14 January 2017 (UTC)
- To me, it is a common problem. Hard for me to believe many others don't run into it. At least until the bug is fixed, I think it should be addressed in this SDB. (I deleted my previous remarks. This isn't an appropriate place for me to vent my frustrations with OpenSuSE.) Huff-N-Puff (talk) 22:03, 19 January 2017 (UTC)