Install Oracle Java 7u79/80 on Fedora 24/23, CentOS/RHEL 7.2/6.8/5.11 - Comment Page: 7
Please note: This guide still working normally if you want install Sun/Oracle Java 7, but if you want Java 8 version, then check Install Oracle Java JDK/JRE 8 on Fedora, CentOS/RHEL.
This is guide, howto Install Sun/Oracle Java JDK and JRE 7 CPU (7u79) and PSU (7u80) on Fedora 24/23/22/21/20/19/18/17/16/15/14/13/12, CentOS 7.2/6.8/5.11, Red Hat (RHEL) 7.2/6.8/5.11. Read more, what is difference between CPU and PSU release.
If you're looking instruction for Sun/Oracle Java JDK/JRE version 6 installation on Fedora 20/19/18, CentOS/Red Hat (RHEL) 6.5/5.10, please check this guide.
[inttf_post_ad1]
What's new in Sun/Oracle Java 7
VM
Compressed 64-bit object...
When I install the updates of openjdk I have to set the alternatives to oracle java again. Is there a way around this?
Hi grinsepilz,
Setting higher priority to Oracle Java should work, 200000 should be enough currently. I update this guide also to 200000 priority.
Hi! Thank you for the guide, it’s really helpful. I’ve followed it when installing Oracle’s JDK before, but I am getting the following message now:
[[email protected] Downloads]# rpm -Uvh jdk-7u45-linux-x64.rpm
Preparing... ################################# [100%]
file /etc/init.d/jexec from install of jdk-2000:1.7.0_45-fcs.x86_64 conflicts with file from package jre-1.7.0_21-fcs.x86_64
If I ignore it and follow the instructions, I get the following output when trying to install javaws:
[[email protected] Downloads]# alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 20000
failed to read link /usr/bin/javaws: No such file or directory
Any idea on what might be wrong?
Thanks!
Hi Annibal,
Problem is that you have jre installed and you try install install jdk, please remove jre first:
Then try installation again.
Hi JR. First of all let me say your guide is one of the cleariest and nicest guides I’ve found lately, very well explained and simple to understand (both guide and comment responses :) )
I have a question: I’ve run the installation procedure (didn’t even get the .pack errors):
[[email protected] jgoncalves]# rpm -Uvh Downloads/jdk-7u45-linux-x64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:jdk-2000:1.7.0_45-fcs ################################# [100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
jfxrt.jar...
[[email protected] jgoncalves]# alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 200000
[[email protected] jgoncalves]# alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 200000
[[email protected] jgoncalves]# alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/jre/lib/amd64/libnpjp2.so 200000
[[email protected] jgoncalves]# alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 200000[[email protected] jgoncalves]# alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 200000
The problem rises here, java -version runs clear, javaws doesn’t:
[[email protected] jgoncalves]# java -version
java version "1.7.0_45"
OpenJDK Runtime Environment (fedora-2.4.3.0.fc19-x86_64 u45-b15)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
[[email protected] jgoncalves]# javaws
bash: javaws: command not found...
Just as you mentioned in the commands, I’ve checked libX11:
[[email protected] jgoncalves]# yum install libX11
Loaded plugins: langpacks, refresh-packagekit
updates/19/x86_64/metalink | 28 kB 00:00
updates | 4.6 kB 00:00
updates/19/x86_64/primary_db | 9.2 MB 00:01
(1/2): updates/19/x86_64/pkgtags | 645 kB 00:00
(2/2): updates/19/x86_64/updateinfo | 865 kB 00:00
Package libX11-1.6.0-1.fc19.x86_64 already installed and latest version
Nothing to do
What could be the reason?
Thanks
Hi Apolliom,
First thanks for compliments!
And your problem, looks like also java -version output is wrong, because it’s OpenJDK Runtime Environment.
Could you post output of following commands first:
Hi! Your response went to my spambox and I just saw it now. It’s working now, and thank you very much for your attention :)
Hi JR,
I’ve changed the JDK with alternatives –config (I only saw it later since I stumbled before that step), so it’s like this now:
[[email protected] jgoncalves]# java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
As for alternatives –display java:
[[email protected] jgoncalves]# alternatives --display java
java - status is manual.
link currently points to /usr/java/latest/jre/bin/java
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/bin/java - priority 170045
slave keytool: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/bin/keytool
slave orbd: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/bin/orbd
slave pack200: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/bin/pack200
slave rmid: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/bin/rmid
slave rmiregistry: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/bin/rmiregistry
slave servertool: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/bin/servertool
slave tnameserv: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/bin/tnameserv
slave unpack200: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre/bin/unpack200
slave jre_exports: /usr/lib/jvm-exports/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64
slave jre: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre
slave java.1.gz: /usr/share/man/man1/java-java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64.1.gz
slave keytool.1.gz: /usr/share/man/man1/keytool-java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64.1.gz
slave orbd.1.gz: /usr/share/man/man1/orbd-java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64.1.gz
slave pack200.1.gz: /usr/share/man/man1/pack200-java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64.1.gz
slave rmid.1.gz: /usr/share/man/man1/rmid-java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64.1.gz
slave rmiregistry.1.gz: /usr/share/man/man1/rmiregistry-java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64.1.gz
slave servertool.1.gz: /usr/share/man/man1/servertool-java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64.1.gz
slave tnameserv.1.gz: /usr/share/man/man1/tnameserv-java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64.1.gz
slave unpack200.1.gz: /usr/share/man/man1/unpack200-java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64.1.gz
/usr/java/latest/jre/bin/java - priority 200000
slave keytool: (null)
slave orbd: (null)
slave pack200: (null)
slave rmid: (null)
slave rmiregistry: (null)
slave servertool: (null)
slave tnameserv: (null)
slave unpack200: (null)
slave jre_exports: (null)
slave jre: (null)
slave java.1.gz: (null)
slave keytool.1.gz: (null)
slave orbd.1.gz: (null)
slave pack200.1.gz: (null)
slave rmid.1.gz: (null)
slave rmiregistry.1.gz: (null)
slave servertool.1.gz: (null)
slave tnameserv.1.gz: (null)
slave unpack200.1.gz: (null)
Current `best' version is /usr/java/latest/jre/bin/java.
alternatives –display javaws
[[email protected] jgoncalves]# alternatives --display javaws
failed to read link /usr/bin/javaws: No such file or directory
It’s like it’s not installed at all :\
ls -la /usr/bin/java
[[email protected] jgoncalves]# ls -la /usr/bin/java
lrwxrwxrwx. 1 root root 22 Nov 1 15:23 /usr/bin/java -> /etc/alternatives/java
ls -la /usr/bin/javaws
[[email protected] jgoncalves]# ls -la /usr/bin/javaws
ls: cannot access /usr/bin/javaws: No such file or directory
However, there is javaws.itweb
[[email protected] jgoncalves]# ls -la /usr/bin/j
jar javadoc jobs js jvmjar
java javaws.itweb join json_reformat jwhois
javac jcontrol journalctl json_verify
[[email protected] jgoncalves]# ls -la /usr/bin/javaws.itweb
-rwxr-xr-x. 1 root root 2195 Sep 17 11:07 /usr/bin/javaws.itweb
ls -la /usr/java
[[email protected] jgoncalves]# ls -la /usr/java
total 12
drwxr-xr-x. 3 root root 4096 Oct 30 10:44 .
drwxr-xr-x. 15 root root 4096 Oct 30 10:43 ..
lrwxrwxrwx. 1 root root 16 Oct 30 10:44 default -> /usr/java/latest
drwxr-xr-x. 8 root root 4096 Oct 30 10:43 jdk1.7.0_45
lrwxrwxrwx. 1 root root 21 Oct 30 10:44 latest -> /usr/java/jdk1.7.0_45
Hi again Apolliom,
I had to test this myself and when I install jdk1.7.0_45, I have javaws under /usr/java/jdk1.7.0_45, like:
Could you please post output of following commands:
Both should be there, because latest points to /usr/java/jdk1.7.0_45
Hi JR. Yes they’re there:
[[email protected] yum.repos.d]# ls -la /usr/java/jdk1.7.0_45/bin/javaws
-rwxr-xr-x. 1 root root 127834 Oct 8 14:04 /usr/java/jdk1.7.0_45/bin/javaws
[[email protected] yum.repos.d]# ls -la /usr/java/latest/bin/javaws
-rwxr-xr-x. 1 root root 127834 Oct 8 14:04 /usr/java/latest/bin/javaws
Why doesn’t it recognize the javaws command then? It still shows that:
[[email protected] yum.repos.d]# javaws
bash: javaws: command not found...
and if I try to config using alternatives, it says that there isn’t any /usr/lib/javaws, which is true. :\
This looks strange, could you post output of following command:
Here it is:
[[email protected] ~]# alternatives --list | grep java
failed to read link /usr/bin/javaws: No such file or directory
jaxp_transform_impl auto /usr/share/java/xalan-j2.jar
libjavaplugin.so auto /usr/java/latest/jre/lib/amd64/libnpjp2.so
jre_openjdk manual /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.3.0.fc19.x86_64/jre
jaxp_parser_impl auto /usr/share/java/xerces-j2.jar
jar auto /usr/java/latest/bin/jar
Interesting, then try remove javaws and install it again:
If remove command fail, could you please post error message here? If not, then install it again and check if it’s working?
I’m starting to think my computer is drunk hahaha xD
[[email protected] ~]# alternatives --remove javaws /usr/java/latest/jre/bin/javaws
failed to read link /usr/bin/javaws: No such file or directory
[[email protected] ~]# alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 200000
failed to read link /usr/bin/javaws: No such file or directory
[[email protected] ~]# ll /usr/bin/java*
lrwxrwxrwx. 1 root root 22 Nov 5 12:50 /usr/bin/java -> /etc/alternatives/java
lrwxrwxrwx. 1 root root 23 Oct 30 16:04 /usr/bin/javac -> /etc/alternatives/javac
lrwxrwxrwx. 1 root root 29 Oct 30 10:44 /usr/bin/javadoc -> /usr/java/default/bin/javadoc
-rwxr-xr-x. 1 root root 2195 Sep 17 11:07 /usr/bin/javaws.itweb
:D Okay, try following:
Is it working then?
JR, thanks man.
It solve my problem. :-)
It worked now :D
[[email protected] ~]# rm /usr/bin/javaws
rm: cannot remove ‘/usr/bin/javaws’: No such file or directory
[[email protected] ~]# rm /var/lib/alternatives/javaws
rm: remove regular file ‘/var/lib/alternatives/javaws’? y
[[email protected] ~]# alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 200000
[[email protected] ~]# alternatives --display javaws
javaws - status is auto.
link currently points to /usr/java/latest/jre/bin/javaws
/usr/java/latest/jre/bin/javaws - priority 200000
Current `best' version is /usr/java/latest/jre/bin/javaws.
[[email protected] ~]# alternatives --config javaws
There is 1 program that provides 'javaws'.
Selection Command
-----------------------------------------------
*+ 1 /usr/java/latest/jre/bin/javaws
Enter to keep the current selection[+], or type selection number:
[[email protected] ~]# javaws
Java(TM) Web Start 10.45.2.18-fcs
[...]
It’s a little strange that it didn’t work the first time, but what matters is that it’s running now :)
Thanks a lot for your time JR :D
You are welcome! Excellent to hear, that you got it working! :)
Yes it’s really strange, because alternatives command is exactly same and alternatives command just create/maintain needed symbolic links…
Nice article and the same one many other websites that have posted how to install and configure jre on linux.
But i have observed that the files java and javaws can be found in jre1.7.0_45 but the javac file isnt. All the post i read made reference to javac but my downloaded version of jre1.7.0_45 didnt seem to have that javac file. So want to know if my downloaded version was incomplete or its true that file has been changed in jre1.7.0_45
Hi euoles,
If you read this post carefully, then you should know, that here is not reference to javac on JRE sections (only JDK sections).
Check step. 4b. Install Sun/Oracle JRE …
And if you check 4a. there is also following comment line before javac and jar install commands:
Do you have any idea how to make this clearer?
But, yes difference between JRE and JDK is very simple. JRE is just Java Runtime Environment and JDK is Java Development Kit (which contains also JRE). And if you only want to run java apps, then you need (at least) JRE (JDK works of course too), but if you want compile, pack etc. java code, then you need JDK.
You found javac only from JDK package, because it’s not part of Java Runtime Environment, it’s Java compiler (development tool).
Hi, after following the instructions in a fresh Fedora 19 machine, I got the message:
-bash: /bin/java: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
I’m using the RPM files from Oracle, both JDK and JRE. I’m going to remove java completely and start over again.
Hi Fco,
Did you selected right architecture (32-bit and 64-bit) when you downloaded JRE and JDK?
Hi JR
I did get them both, just as the first post states. I did try to install both JDK and JRE.
Hi again Fco,
Yes I understand, that you tried to install both JDK and JRE, but I asked, did you selected right arch between i586 or x64?
Could you post output of following command:
Then post file names what you downloaded?
Hi JR, I need some help. I (think I) followed the instructions as indicated but the only thing that differs from yours messages is when I use about:plugins on firefox. What appears is listed below. Can you help me? Why the plugin version is still *0_25 if I installed *0_45? Thanks in advance.
Java Plug-in 1.7.0_25
Arquivo: libnpjp2.so
Caminho: /usr/java/jdk1.7.0_45/jre/lib/amd64/libnpjp2.so
Versão:
Status: Ativo (STATE_VULNERABLE_UPDATE_AVAILABLE)
Java plug-in for NPAPI-based browsers.
Hi dac,
Try:
What is output?
Just checked mine Firefox about:plugins output and it’s following:
Hi JR,
This is what I get after alternatives…
Há 6 programas que oferecem “libjavaplugin.so.x86_64”.
Seleção Comando
———————————————–
1 /usr/java/jdk1.7.0_40/jre/lib/amd64/libnpjp2.so
2 /usr/lib/jvm/jre-1.7.0u25-sun-x64/lib/amd64/libnpjp2.so
* 3 /usr/java/latest/jre/lib/amd64/libnpjp2.so
+ 4 /usr/java/jdk1.7.0_45/jre/lib/amd64/libnpjp2.so
5 /usr/etc/jdk1.7.0_45/jre/lib/amd64/libnpjp2.so
6 /usr/java/latest/lib/amd64/libnpjp2.so
It doesn’t matter if I set option 4 or 5.
Thanks, looks good.
Do you have done any special setup with 7u25 earlier? Like copied libnpjp2.so some where or something like that? What version of Firefox you are using?
Could you maybe try to remove 7u25 installation?
Well, I really don’t remember doing any special setup. But the first install(7u25) was made by easylife(important?), then I tryed update to versions 40 and 45 with no success. the firefox version is 26.0.