Friday, April 8, 2022

[SOLVED] Can't install jdk on Fedora with yum nor with rpm

Issue

Help! I can't figure out how to install a jdk!

[/usr/lib/jvm]$ su -c "yum install java-1.7.0-openjdk-devel"
Loaded plugins: langpacks, presto, refresh-packagekit
No package java-1.7.0-openjdk-devel available.
Error: Nothing to do

[/usr/lib/jvm]$ su -c "yum install java-1.7.0-openjdk"
Loaded plugins: langpacks, presto, refresh-packagekit
No package java-1.7.0-openjdk available.
Error: Nothing to do

[/usr/lib/jvm]$ su -c "yum install java-1.6.0-openjdk-devel"
Loaded plugins: langpacks, presto, refresh-packagekit
No package java-1.6.0-openjdk-devel available.
Error: Nothing to do

[/usr/lib/jvm]$ su -c "yum install java-1.6.0-openjdk"
Loaded plugins: langpacks, presto, refresh-packagekit
No package java-1.6.0-openjdk available.
Error: Nothing to do

Here I've manually downloaded some rpm's, the last one from oracle's website:

[~]$ rpm -ivh java-1.7.0-openjdk-devel-1.7.0.19-2.3.9.3.fc20.x86_64.rpm 
error: Failed dependencies:
    java-1.7.0-openjdk = 1:1.7.0.19-2.3.9.3.fc20 is needed by java-1.7.0-openjdk-devel-1:1.7.0.19-2.3.9.3.fc20.x86_64


[~]$ sudo rpm -ivh java-1.7.0-openjdk-1.7.0.19-2.3.9.3.fc20.x86_64.rpm 
Preparing...                          ################################# [100%]
    file /usr/lib/jvm-exports/jre-1.7.0-openjdk.x86_64 from install of java-1.7.0-openjdk-1:1.7.0.19-2.3.9.3.fc20.x86_64 conflicts with file from package java-1.7.0-openjdk-1:1.7.0.9-2.3.7.0.fc18.x86_64
    file /usr/lib/jvm/jre-1.7.0-openjdk.x86_64 from install of java-1.7.0-openjdk-1:1.7.0.19-2.3.9.3.fc20.x86_64 conflicts with file from package java-1.7.0-openjdk-1:1.7.0.9-2.3.7.0.fc18.x86_64


[~]$ sudo rpm -ivh jdk-7u21-linux-x64.rpm 
Preparing...                          ################################# [100%]
    file /etc/init.d/jexec from install of jdk-2000:1.7.0_21-fcs.x86_64 conflicts with file from package jdk-2000:1.6.0_38-fcs.x86_64

Debug

Here's some debug information:

[/usr/lib/jvm]$ yum search jdk
Loaded plugins: langpacks, presto, refresh-packagekit
=========================================================== N/S Matched: jdk ============================================================
java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation
jdk.x86_64 : Java(TM) Platform Standard Edition Development Kit
ldapjdk.noarch : The Mozilla LDAP Java SDK
Name and summary matches only, use "search all" for everything.

.

[/usr/lib/jvm]$ yum list java*
Loaded plugins: langpacks, presto, refresh-packagekit
Installed Packages
java-1.5.0-gcj.x86_64   

.

[/usr/lib/jvm]$ cat /etc/fedora-release 
Fedora release 18 (Spherical Cow)

Requirements

I must have "jni.h", "libjava.so", "libhpi.so", "lipverify.so" and "libjvm.so" included.

So far I've found out that these DO NOT have what I need:

  • Undesired Versions (for sure):
    • jdk1.7.0_06 <-- I'm surprised about this one, but it doesn't have libjvm nor libhpi
    • java-1.7.0
    • java-openjdk
    • java-1.7.0-openjdk-1.7.0.9.x86_64
    • java-1.5.0-gcj-4.4
    • java-1.6.0-openjdk
    • java-1.7.0-openjdk.x86_64
    • jre-1.5.0-gcj
    • jre-1.7.0-openjdk.x86_64
    • jre-openjdk
    • jre-1.7.0
    • jre-7u11-linux-x64.rpm java-1.5.0-gcj-1.5.0.0
    • jre-1.5.0
    • jre1.7.0_11
    • jre-gcj

And these do:

  • Desired Versions (that I know of, there could be more):
    • jdk1.6.0_34-x86
    • jdk1.5.0_22-x86
    • java-6-openjdk

Can someone help me install jdk1.6 or java-6-openjdk please?


Solution

The problem here is that you cannot use the Oracle rpm to install JDK 7 when you already have the Oracle JDK 6 as it tries to install the /etc/init.d/jexec script which is already installed and required for JDK 6.

I would advise sticking to the tarball or self extracting *.bin and using JAVA_HOME if you are going to use the Oracle distribution as it does not have this problem and you will probably not need jexec anyway.



Answered By - Kevin Cross
Answer Checked By - Terry (WPSolving Volunteer)