Install Oracle Java 7u79/80 on Fedora 24/23, CentOS/RHEL 7.2/6.8/5.11 - Comment Page: 2
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...
[…] used to barrel ahead willy nilly People say I'm not doing my work I'm sorry but I found this page Install Sun/Oracle Java JDK/JRE 7 on Fedora 15/14, CentOS/RHEL 5.6/6 [email protected]:/home/kayve/src# rpm -Uvh jdk-7-linux-x64.rpm rpm: RPM should not be used […]
thank you, thank you, thank you
why do we need the
## export JAVA_HOME JDK ##
export JAVA_HOME=”/usr/java/jdk1.7.0″
## export JAVA_HOME JRE ##
export JAVA_HOME=”/usr/java/jre1.7.0″
after installation?
what’s the intention?
Hi asker,
By using environment variables you can easily change a configuration setting for one or more applications. Example JAVA_HOME is widely used environment variable on Java programs. So setting the JAVA_HOME environment variable is not mandatory, but I recommend it… :)
I found that Oracle’s Java 7 release wasn’t really working for me. Any way to revert the settings to their defaults (so my system will be using the already-installed OpenJDK version instead)?
Hi DaVince,
You can actually use both OpenJDK and Oracle’s Java 7 simultaneously.
You can run following commands and select OpenJDK instead of Oracle’s Java 7:
Check more from this guide 6. Swap between OpenJDK and Sun/Oracle Java JDK/JRE 6 and 7 versions
Then if you want / you have to use Java 7 later then you can switch it back same way or use directly like following:
What happens after an upgrade of either openjdk or sun jdk? Does one have to go through all these again?
Hi Napo,
Actually yes, but there is of course workaround for that…you could also use /usr/java/default or /usr/java/latest and then after upgrade it’s work with any other actions following commands should work smoothly.
JDK
JRE
You could easily check where your default and latest point with following command:
Of course this latest should always point to latest java so if you want to use OpenJDK 6 and Oracle’s JDK/JRE 7 then you should do some manual work anyways. I personally prefer this absolute method (I change between Java versions using alternatives –config command), because I want to be sure what version I’m using, but actually for many users (who just use Java especially JRE) it might be better use latest version always…and this is good point and I will add that also this guide. Thanks! :)
Hi and thanks for your guide. I have followed your instructions to the best of my knowledge but I must have made a mistake somewhere I cannot identify. I’ll copy here my config just in case you can help. Thanks again,
which java
/usr/bin/java
which javaws
/usr/bin/which: no javaws in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
update-alternatives --config javaws
error al leer enlace /usr/bin/javaws: No existe el fichero o el directorio
However, there is a /usr/bin/javaws.itweb
update-alternatives --config libjavaplugin.so.x86_64
Hay 5 programas que proporcionan 'libjavaplugin.so.x86_64'.
Selección Comando
-----------------------------------------------
* 1 /usr/java/default/lib/amd64/libnpjp2.so
2 /usr/lib64/IcedTeaPlugin.so
3 /usr/java/latest/jre/lib/amd64/libnpjp2.so
4 /usr/java/latest/lib/amd64/libnpjp2.so
+ 5 /usr/java/jdk1.7.0_01/jre/lib/amd64/libnpjp2.so
Presione Intro para mantener la selección actual[+], o escriba el número de la selección: 5
which javac
/usr/bin/javac
update-alternatives --config javac
Hay 3 programas que proporcionan 'javac'.
Selección Comando
-----------------------------------------------
1 /usr/lib/jvm/java-1.6.0-openjdk.x86_64/bin/javac
* 2 /usr/java/latest/bin/javac
+ 3 /usr/java/jdk1.7.0_01/bin/javac
Presione Intro para mantener la selección actual[+], o escriba el número de la selección: 3
update-alternatives --config java
Hay 5 programas que proporcionan 'java'.
Selección Comando
-----------------------------------------------
1 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
2 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
* 3 /usr/java/latest/jre/bin/java
4 /usr/java/latest/bin/java
+ 5 /usr/java/jdk1.7.0_01/jre/bin/java
Presione Intro para mantener la selección actual[+], o escriba el número de la selección: 5
ls -la /usr/java
total 12
drwxr-xr-x. 3 root root 4096 nov 15 02:17 .
drwxr-xr-x. 14 root root 4096 oct 3 10:56 ..
lrwxrwxrwx. 1 root root 16 nov 15 00:33 default -> /usr/java/latest
drwxr-xr-x. 10 root root 4096 nov 15 00:33 jdk1.7.0_01
lrwxrwxrwx. 1 root root 21 nov 15 00:33 latest -> /usr/java/jdk1.7.0_01
echo $JAVA_HOME
/usr/java/jdk1.7.0_01
cat /etc/profile.d/sunjava.sh
# export JAVA_HOME=/usr/java/default
# export PATH=$JAVA_HOME/bin:$PATH
## export JAVA_HOME JDK ##
export JAVA_HOME="/usr/java/jdk1.7.0_01"
grep -r JAVA_HOME /etc/* | grep JAVA
/etc/init.d/jetty:export JAVA_HOME
/etc/java/java.conf:#JAVA_HOME=$JVM_ROOT/jre
/etc/java/java.conf:#JAVA_HOME=$JVM_ROOT/java
/etc/profile.d/sunjava.sh~:# export JAVA_HOME=/usr/java/default
/etc/profile.d/sunjava.sh~:# export PATH=$JAVA_HOME/bin:$PATH
/etc/profile.d/sunjava.sh~:## export JAVA_HOME JDK ##
/etc/profile.d/sunjava.sh~:export JAVA_HOME="/usr/java/jdk1.7.0_01"
/etc/profile.d/sunjava.sh:# export JAVA_HOME=/usr/java/default
/etc/profile.d/sunjava.sh:# export PATH=$JAVA_HOME/bin:$PATH
/etc/profile.d/sunjava.sh:## export JAVA_HOME JDK ##
/etc/profile.d/sunjava.sh:export JAVA_HOME="/usr/java/jdk1.7.0_01"
/etc/rc0.d/K20jetty:export JAVA_HOME
/etc/rc1.d/K20jetty:export JAVA_HOME
/etc/rc2.d/K20jetty:export JAVA_HOME
/etc/rc3.d/K20jetty:export JAVA_HOME
/etc/rc4.d/K20jetty:export JAVA_HOME
/etc/rc5.d/K20jetty:export JAVA_HOME
/etc/rc6.d/K20jetty:export JAVA_HOME
/etc/rc.d/rc3.d/K20jetty:export JAVA_HOME
/etc/rc.d/rc6.d/K20jetty:export JAVA_HOME
/etc/rc.d/rc2.d/K20jetty:export JAVA_HOME
/etc/rc.d/init.d/jetty:export JAVA_HOME
/etc/rc.d/rc4.d/K20jetty:export JAVA_HOME
/etc/rc.d/rc5.d/K20jetty:export JAVA_HOME
/etc/rc.d/rc1.d/K20jetty:export JAVA_HOME
/etc/rc.d/rc0.d/K20jetty:export JAVA_HOME
/etc/rpm/macros.jpackage:%java_home %(. %{_javadir}-utils/java-functions; set_jvm; echo $JAVA_HOME)
/etc/rpm/macros.jpackage:%ant JAVA_HOME=%{java_home} ant
/etc/sysconfig/hsqldb:JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/jre}
/etc/sysconfig/hsqldb:JAVA_EXECUTABLE=${JAVA_HOME}/bin/java
Hi Jose,
So your problem is javaws?
Could you post output of following command:
i also have the same problem. it seems javaws is not working. :(
Hi there , i try to install “Wakfu” and “Play it” , but , i have Fedora 16 64 Bits , with the lastest kernel , and lastest Nvidia Drivers .
But the Game requiere “openjdk / jre” of 32 Bits , but i need the 64 Bits openjdk / jre , installed too .
Someone know how i can install both ???
Thanks
Hi inukaze,
So you want to install OpenJDK 32-bit and 64-bit version and not Oracle JRE / JDK?
[…] Sun’s Java, because I think NetBeans works faster with Sun’s Java. Here is the guide, howto install Sun/Oracle Java JDK 6 on Fedora, CentOS, Red Hat (RHEL). OpenJDK should also […]
[…] http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-ha… […]
All this doesn’t work for Fedora 16 and JRE – Java 7u2 :-(
Hi gizmo,
I just updated my Java 7 to latest version 7u2 and also updated this guide and yes it works for me.
Could you tell more specific, what error messages you get? Or why it doesn’t work?
What I do is;
I download JRE rpm version 7u2
then:
sudo -i
rpm -Uvh /path/to/binary/jre-7u2-linux-i586.rpm
alternatives –install /usr/bin/java java /usr/java/latest/bin/java 20000
alternatives –install /usr/bin/javaws javaws /usr/java/latest/bin/javaws 20000
alternatives –install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/lib/i386/libnpjp2.so 20000
and after:
java -version
it says
java version “1.7.0_02”
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)
so OK.
But after few minutes when trying:
java -version
it says Bash: java: command not found
So I guess there is something wrong with my JAVA :-(
Before I installed Libreoffice and it installed OpenJDK 1.6.0 and 1.7.0
but I need Oracle’s one to print my internet invoices
What am I doing wrong?
Also I uninstalled jre (OpenJDK 1.6.0 and 1.7.0 with whole Libreoffice and Oracle 7u2), but this:
alternatives –config java
shows 2 alternatives to choose from:
*+ 1 /usr/java/latest/jre/bin/java
2 /usr/java/latest/bin/java
So some trash still there?
Thank you for good description. Let’s try to solve this problem… :)
Could you first post output of following commands:
I reinstalled Fedora 16 (since before it was also fresh install but after Libreoffice and some other software installed).
And now it’s working.
Thank you JR for your help and for great tutorial.
It was definitely my fault.
I just wish that now after installing Libreoffice it will still work.
I installed Libreoffice (which installed OpenJDK 1.6.0 and 1.7.0) and java still works (I mean Oracle Java 7u2).
Once again – thank you.
I’m sorry for the confusion.
You are very welcome! Nice to hear that you got it working!
I have also always OpenJDK installed all my systems and it works nicely with Oracle Java. :)
And no problem at all!
errata “Select rpm.bin” should be “Select rpm”
Thanks Glenn! I fixed it, yes it should be just “rpm” :)
Okay! Great post! Thanks a lot! Managed to get Java up and running. Although, I have one doubt. How do I keep this JDK up to date with future releases from Oracle ? Since they often release updates to their JDKs it is necessary to keep up to date. How do I go about this?
Hi Sreeram,
You have to download and install Oracle Java manually, because of Oracle Binary Code License Agreement for Java SE, but it’s easy process if you use this guide “latest” method.
Many thanks. This worked perfectly. Fantastic!
I appreciate your work.
Hi JR,
Thanks for this very great guide. I followed step by step but at the end when checking the configuration I get:
Java(TM) Web Start 10.0.0.13-fcs
[…]
after executing the
javaws
command.ls -la /usr/java/jdk1.7.0_02/jre/bin/
total 396
drwxr-xr-x. 2 root root 4096 Jan 1 23:51 .
drwxr-xr-x. 5 root root 4096 Jan 1 23:51 ..
lrwxrwxrwx. 1 root root 8 Jan 1 23:51 ControlPanel -> jcontrol
-rwxr-xr-x. 1 root root 5654 Nov 17 16:47 java
-rwxr-xr-x. 1 root root 16017 Nov 17 16:47 java_vm
-rwxr-xr-x. 1 root root 79096 Nov 17 16:47 javaws
-rwxr-xr-x. 1 root root 6395 Nov 17 16:39 jcontrol
-rwxr-xr-x. 1 root root 5809 Nov 17 16:47 keytool
-rwxr-xr-x. 1 root root 5953 Nov 17 16:47 orbd
-rwxr-xr-x. 1 root root 5829 Nov 17 16:47 pack200
-rwxr-xr-x. 1 root root 5913 Nov 17 16:47 policytool
-rwxr-xr-x. 1 root root 5805 Nov 17 16:47 rmid
-rwxr-xr-x. 1 root root 5809 Nov 17 16:47 rmiregistry
-rwxr-xr-x. 1 root root 5825 Nov 17 16:47 servertool
-rwxr-xr-x. 1 root root 5981 Nov 17 16:47 tnameserv
-rwxr-xr-x. 1 root root 215415 Nov 17 16:47 unpack200
env |grep -i -e java -e path
PATH=/usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:
/usr/sbin:/sbin:/home/tae/.local/bin:/home/tae/bin
JAVA_HOME=/usr/java/latest
WINDOWPATH=1
Hi TAE,
Actually your output is just ok, it should Java(TM) Web Start 10.0.0.13-fcs. :)
You could verify it with following command: