Strange error attempting to install Oracle JRE 8

I’m installing Oracle Java 8 because it’s required by another software package. I’m following the instructions in https://en.opensuse.org/SDB:Installing_Java#Java_Runtime_Environment_Install_using_Oracle.27s_RPM and the JDK install went fine, but installing JRE is going badly. Here’s what I’m seeing:


@17:55:39,root@pinto
~
█ rpm -ivf /usr/local/RPMrepository/jre-8u221-linux-x64.rpm
**warning: /usr/local/RPMrepository/jre-8u221-linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing packages...
        package jre1.8-1.8.0_221-fcs.x86_64 is already installed**
@17:56:52,root@pinto
~
█ ll /usr/java/jre1.8.0_221-amd64/bin/java
**-rwxr-xr-x 1 root root 8534 2019-07-04 06:41:51 /usr/java/jre1.8.0_221-amd64/bin/java**
@17:57:02,root@pinto
~
█ file /usr/java/jre1.8.0_221-amd64/bin/java
**/usr/java/jre1.8.0_221-amd64/bin/java: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.9, not stripped**
@17:57:06,root@pinto
~
█ /usr/java/jre1.8.0_221-amd64/bin/java -version
**java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)**
@17:57:09,root@pinto
~
█ update-alternatives --install  "/usr/bin/java" "java" "/usr/java/jre1.8.0_211-amd64/bin/java" 1
**update-alternatives: error: alternative path /usr/java/jre1.8.0_211-amd64/bin/java doesn't exist**

For some reason, update-alternatives doesn’t recognize the java module. What’s going on?

Leslie

Run

strace -f -o /tmp/java.strace update-alternatives --install  "/usr/bin/java" "java" "/usr/java/jre1.8.0_211-amd64/bin/java" 1

and post /tmp/java.strace to http://susepaste.org/

When you install a JDK, the JRE should already be included.
Don’t do anything more, and it’s unknown if you do anything whether you might damage your JDK/JRE.

In other words, just point your alternatives to your JDK and your apps that require the JRE will “just work.”

TSU

I don’t seem to be able to create an entry in http://susepaste.org/; I get this message when I press the [create] button:


[openSUSE Paste](https://susepaste.org/) >  Error                         [Login](https://susepaste.org/user/login)                                          
 **404 Page Not Found**
The page you requested was not found.

N.B. If I try to login to http://susepaste.org/ it asks for an “OpenID”, whatever that is.

Leslie

Oh, yes; reviewing the SDB article, I see that I overlooked that in the introductory information.

So (just to be sure I understand how this works) the update-alternatives settings for the JDK will carry over to the JRE as well? My system still retains the Java 10 that came with the original installation, for use by other more up-to-date tools.

Leslie

I am concerned as to whether JRE 8 will work properly with the update-alternatives system because of what I see in its configuration:


@14:24:27,root@pinto
~
█ update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                    Priority   Status
------------------------------------------------------------
  0            /usr/lib64/jvm/jre-10-openjdk/bin/java   2005      auto mode
[b]* 1            /usr/java/latest/bin/java                1         manual mode[/b]
  2            /usr/lib64/jvm/jre-10-openjdk/bin/java   2005      manual mode

Press <enter> to keep the current choice
[li], or type selection number:[/li]@14:24:44,root@pinto
~
█ update-alternatives --config javac
There are 2 choices for the alternative javac (providing /usr/bin/javac).

  Selection    Path                                      Priority   Status
------------------------------------------------------------
  0            /usr/lib64/jvm/java-10-openjdk/bin/javac   2005      auto mode
* 1            /usr/java/jdk1.8.0_221-amd64/bin/javac     3         manual mode
  2            /usr/lib64/jvm/java-10-openjdk/bin/javac   2005      manual mode

Press <enter> to keep the current choice
[li], or type selection number:[/li]

Leslie

As pointed out, the JDK contains the JRE, so installation of JRE would be redundant. Further testing confirms that it is not needed.

Think of the situation this way…

The Java Runtime** E**nvironment (JRE) is only what is necessary to provide what is needed to run a Java application.
The Java Development Kit (JDK) is a collection of development tools, but how can you use those tools without being able to run the Java application you’re building? - So, the JRE has to be included in the JDK.

If you have the JDK 10 (oracle or openjdk), you should see an alternatives entry, so can switch between any you wish.
Typically, apps will run in at least the next more recent version without a problem.
Also, you should know that no matter what documentation says, apps should be able to run in the Oracle or openjdk versions of Java (JRE) with no difference, and although at one time there was only one significant compiler difference I notice that today several tools might be evolving at a different paces (JDK).
Note that the “openjdk” package is actually the JRE, and “openjdk-devel” is the JDK.

TSU