Install Sun/Oracle Java JDK/JRE 7u4 on Fedora 16/15, CentOS/RHEL 6.2/5.8
This is guide, howto Install Sun/Oracle Java JDK and JRE 7 update 4 (7u4) on Fedora 16, Fedora 15, Fedora 14, Fedora 13, Fedora 12, CentOS 6.2/6.1/6/5.8, Red Hat (RHEL) 6.2/6.1/6/5.8.
If you’re looking instruction for Sun/Oracle Java JDK/JRE version 6 installation on Fedora 16/15, CentOS/Red Hat (RHEL) 6.2/5.8, please check this guide.
What’s new in Sun/Oracle Java 7
- VM
- Compressed 64-bit object pointers
- Garbage-First GC (G1)
- JSR 292: VM support for non-Java languages (InvokeDynamic)
- Lang
- JSR 294: Language and VM support for modular programming
- JSR 308: Annotations on Java types
- JSR TBD: Small language enhancements (Project Coin)
- JSR TBD: Project Lambda
- Core
- Modularization (Project Jigsaw)
- Upgrade class-loader architecture
- Method to close a URLClassLoader
- Unicode 5.1
- Concurrency and collections updates (jsr166y)
- JSR 203: More new I/O APIs for the Java platform (NIO.2)
- SCTP (Stream Control Transmission Protocol)
- SDP (Sockets Direct Protocol)
- Elliptic-curve cryptography (ECC)
- Client
- XRender pipeline for Java 2D
- Forward-port 6u10 deployment features
- Create new platform APIs for 6u10 graphics features
- Nimbus look-and-feel for Swing
- Swing JLayer component
- Web
- Update the XML stack
Read full info from here.
Install Sun/Oracle Java JDK/JRE 7u4 on Fedora 16/15/14/13/12, CentOS 6.2/6.1/6/5.8, Red Hat (RHEL) 6.2/6.1/6/5.8
1. Download Sun/Oracle Java JDK/JRE 7u4 32-bit/64-bit RPM packages
Download Sun/Oracle Java 7u4 from here http://www.oracle.com/technetwork/java/javase/downloads/index.html. Select rpm package (jdk-7u4-linux-i586.rpm, jdk-7u4-linux-x64.rpm, jre-7u4-linux-i586.rpm or jre-7u4-linux-x64.rpm).
2. Change to root user.
sudo -i ## OR ## su -
3. Install Java JDK or JRE package
## JDK 32-bit ## rpm -Uvh /path/to/binary/jdk-7u4-linux-i586.rpm ## JDK 64-bit ## rpm -Uvh /path/to/binary/jdk-7u4-linux-x64.rpm ## JRE 32-bit ## rpm -Uvh /path/to/binary/jre-7u4-linux-i586.rpm ## JRE 64-bit ## rpm -Uvh /path/to/binary/jre-7u4-linux-x64.rpm
4a. Install Sun/Oracle JDK java, javaws, libjavaplugin.so (for Firefox/Mozilla) and javac with alternatives –install command
Use Java JDK latest version (/usr/java/latest)
## java ## alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 20000 ## javaws ## alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 20000 ## Java Browser (Mozilla) Plugin 32-bit ## alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/jre/lib/i386/libnpjp2.so 20000 ## Java Browser (Mozilla) Plugin 64-bit ## alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/jre/lib/amd64/libnpjp2.so 20000 ## Install javac only if you installed JDK (Java Development Kit) package ## alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 20000 alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 20000
Use Java JDK absolute version (/usr/java/jdk1.7.0_04)
## java ## alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_04/jre/bin/java 20000 ## javaws ## alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.7.0_04/jre/bin/javaws 20000 ## Java Browser (Mozilla) Plugin 32-bit ## alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jdk1.7.0_04/jre/lib/i386/libnpjp2.so 20000 ## Java Browser (Mozilla) Plugin 64-bit ## alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jdk1.7.0_04/jre/lib/amd64/libnpjp2.so 20000 ## Install javac only if you installed JDK (Java Development Kit) package ## alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0_04/bin/javac 20000 alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0_04/bin/jar 20000
4b. Install Sun/Oracle JRE java, javaws and libjavaplugin.so (for Firefox/Mozilla) with alternatives –install command
Use Java JRE latest version (/usr/java/latest)
## java ## alternatives --install /usr/bin/java java /usr/java/latest/bin/java 20000 ## javaws ## alternatives --install /usr/bin/javaws javaws /usr/java/latest/bin/javaws 20000 ## Java Browser (Mozilla) Plugin 32-bit ## alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/lib/i386/libnpjp2.so 20000 ## Java Browser (Mozilla) Plugin 64-bit ## alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000
Use Java JRE absolute version (/usr/java/jre1.7.0_04)
## java ## alternatives --install /usr/bin/java java /usr/java/jre1.7.0_04/bin/java 20000 ## javaws (32-bit only) ## alternatives --install /usr/bin/javaws javaws /usr/java/jre1.7.0_04/bin/javaws 20000 ## Java Browser (Mozilla) Plugin 32-bit ## alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jre1.7.0_04/lib/i386/libnpjp2.so 20000 ## Java Browser (Mozilla) Plugin 64-bit ## alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jre1.7.0_04/lib/amd64/libnpjp2.so 20000
5. Check current java, javac, javaws and libjavaplugin.so versions
java -version java version "1.7.0_04" Java(TM) SE Runtime Environment (build 1.7.0_04-b04) Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode) javaws Java(TM) Web Start 10.0.0.4-fcs [...] javac -version javac 1.7.0_04
Note: Check libjavaplugin.so with restarting Mozilla Firefox and writing about:plugins on address bar.
6. Swap between OpenJDK and Sun/Oracle Java JDK/JRE 6 and 7 versions
java
alternatives --config java There are 5 programs which provide 'java'. Selection Command ----------------------------------------------- * 1 /usr/java/jdk1.6.0_24/jre/bin/java 2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java + 3 /usr/java/jdk1.6.0_26/jre/bin/java 4 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java 5 /usr/java/jdk1.7.0_04/jre/bin/java Enter to keep the current selection[+], or type selection number: 5
Note: java with [+] is currently on use
javaws
alternatives --config javaws There are 3 programs which provide 'javaws'. Selection Command ----------------------------------------------- * 1 /usr/java/jdk1.6.0_24/jre/bin/javaws + 2 /usr/java/jdk1.6.0_26/jre/bin/javaws 3 /usr/java/jdk1.7.0_04/jre/bin/javaws Enter to keep the current selection[+], or type selection number: 3
Note: java with [+] is currently on use
libjavaplugin.so (32-bit)
alternatives --config libjavaplugin.so There are 3 programs which provide 'libjavaplugin.so'. Selection Command ----------------------------------------------- * 1 /usr/java/jdk1.6.0_24/jre/lib/i386/libnpjp2.so + 2 /usr/java/jdk1.6.0_26/jre/lib/i386/libnpjp2.so 3 /usr/java/jdk1.7.0_04/jre/lib/i386/libnpjp2.so Enter to keep the current selection[+], or type selection number: 3
libjavaplugin.so.x86_64 (64-bit)
alternatives --config libjavaplugin.so.x86_64 There are 3 programs which provide 'libjavaplugin.so.x86_64'. Selection Command ----------------------------------------------- * 1 /usr/java/jdk1.6.0_24/jre/lib/amd64/libnpjp2.so + 2 /usr/java/jdk1.6.0_26/jre/lib/amd64/libnpjp2.so 3 /usr/java/jdk1.7.0_04/jre/lib/amd64/libnpjp2.so Enter to keep the current selection[+], or type selection number: 3
javac
alternatives --config javac There are 3 programs which provide 'javac'. Selection Command ----------------------------------------------- * 1 /usr/java/jdk1.6.0_24/bin/javac + 2 /usr/java/jdk1.6.0_26/bin/javac 3 /usr/java/jdk1.7.0_04/bin/javac Enter to keep the current selection[+], or type selection number: 3
Note: java with [+] is currently on use
Post-Installation Setup
Add JAVA_HOME environment variable to /etc/profile file or $HOME/.bash_profile file
Java JDK and JRE latest version (/usr/java/latest)
## export JAVA_HOME JDK/JRE ## export JAVA_HOME="/usr/java/latest"
Java JDK and JRE absolute version (/usr/java/jdk1.7.0_04)
## export JAVA_HOME JDK ## export JAVA_HOME="/usr/java/jdk1.7.0_04" ## export JAVA_HOME JRE ## export JAVA_HOME="/usr/java/jre1.7.0_04"
Related posts:
- Install Sun/Oracle Java JDK/JRE 6u32 on Fedora 16/15, CentOS/RHEL 6.2/5.8
- Install VirtualBox 4.1.14 on Fedora 16/15, CentOS/Red Hat (RHEL) 6.2/5.8
- Install Eclipse SDK 3.7.2 (Indigo) on Fedora 16/15, CentOS/RHEL 6.2/5.8
- Install MongoDB 2.0.4 on Fedora 16/15, CentOS/Red Hat (RHEL) 6.2/5.8
- Install SVN (Subversion) Server on Fedora 16/15, CentOS/Red Hat (RHEL) 6.2/5.8
67 Comments
Leave a Comment
Trackbacks/Pingbacks
- Install Sun/Oracle Java JDK/JRE 7 (b108) on Fedora 13/CentOS 5.5 … | java - [...] więcej: Install Sun/Oracle Java JDK/JRE 7 (b108) on Fedora 13/CentOS 5.5 … fedora, jre, main, main-guide, rhel, ...
- Install Sun/Oracle Java JDK/JRE 6u26 on Fedora 15, CentOS/RHEL 5.6/6 - [...] Install Sun/Oracle Java JDK/JRE 6u26 on Fedora 15, CentOS/RHEL 5.6/6By JR – Published: July 29, 2010 – Last Updated: ...
- Android SDK r12 and Eclipse ADT on Fedora 15/14, CentOS/Red Hat (RHEL) 6 - [...] 1.1 Install Sun/Oracle Java 7 JDK/JRE [...]
- Create Full Screen Graphic Displayer - Page 2 - [...] used to barrel ahead willy nilly People say I'm not doing my work I'm sorry but I found this ...
- NetBeans 7.0.1 / 7.1 RC1 on Fedora 16/15, CentOS/RHEL 6/5.7 - [...] Sun’s Java, because I think NetBeans works faster with Sun’s Java. Here is the guide, howto install Sun/Oracle Java ...
- Installing Java on CentOS 6 and configuring it to use for PHPStrom | Simple Coder - [...] http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-ha... [...]
- java working but not in firefox - [...] again. I found this very useful when I set up my java, complete with an alternatives chooser: http://www.if-not-true-then-false.co...-red-hat-rhel/ -- ...
- How do I install Java on CentOS 6.2? - [...] you want to install JRE on CentOS, follow the steps in this link. I have used this in the ...

Thanks for publishing this java installation guide.
Hey good guide. just one suggestion. Oracle puts out an rpm.bin file. if you install that then it will make a folder in /usr/java called jdk-something and another called latest which will point at that one. you should use the rpm and then always upgrade that way. have alternatives point to /usr/bin/latest and youll never have to change it again if you want to use Oracles Java
Err. edit from previous post it should be /usr/java/latest *
Hi Joshua,
I still use just .bin file on this guide, because I can’t get Oracles rpm.bin file working. I just got following error message when trying to install rpm.bin file:
Do you get it to work normally?
Hi JR,
I am new to linux but I have just installed jdk7 using rpm.(I think).
Just like you described I also got the “Failed to extract the files” message, but a jdk-7-ea-linux-i586.rpm was left in my dowload directory.
I used this with rpm and it ran to conclusion.
When I enter ‘java -version’ it responds with ’1.7.0-ea’. same for javac.
When I enter “alternatives –config javac” nothing happens.
Is there any other way I can check if all is installed correctly?
Thanks
Roy
Hi roy,
Sounds, it appears that your java and javac is the correct version.
Did you completed alternatives commands?
good tutorial man thx
Thanks for sharing.
Guia super chingona !!
Thanks !! This Java Guide is great
Would this break the existing alternatives “slave” system? Normally when you switch the link to java, it also switches the link to a number of other utilities as well as making sure the correct man pages are used. I’m too lazy to type out a version with all of the man pages and so forth, but wouldn’t something like this be more in line with the usual alternatives flow?
alternatives \
–install /usr/bin/java java /usr/java/jdk1.7.0/jre/bin/java 17000 \
–slave /usr/lib/jvm/jre jre /usr/java/jdk1.7.0/jre \
–slave /usr/lib/jvm-exports/jre jre_exports /usr/java/jdk1.7.0/jre/lib \
–slave /usr/bin/keytool keytool /usr/java/jdk1.7.0/jre/bin/keytool \
–slave /usr/bin/orbd orbd /usr/java/jdk1.7.0/jre/bin/orbd \
–slave /usr/bin/pack200 pack200 /usr/java/jdk1.7.0/jre/bin/pack200 \
–slave /usr/bin/rmid rmid /usr/java/jdk1.7.0/jre/bin/rmid \
–slave /usr/bin/rmiregistry rmiregistry /usr/java/jdk1.7.0/jre/bin/rmiregistry \
–slave /usr/bin/servertool servertool /usr/java/jdk1.7.0/jre/bin/servertool \
–slave /usr/bin/tnameserv tnameserv /usr/java/jdk1.7.0/jre/bin/tnameserv \
–slave /usr/bin/unpack200 unpack200 /usr/java/jdk1.7.0/jre/bin/unpack200
It makes me wonder why the oracle jdk 1.7 RPM doesn’t do this for you during post-install…
One thing that can be done if you don’t want to install both the jdk and jre is to change the mozilla plugin line for the alternatives –install to
## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jdk1.7.0/lib/i386/libnpjp2.so 20000
Hi Joe,
I use normally /usr/java/jdk1.7.0/jre/lib/i386/libnpjp2.so and it’s also on this guide. It works nice for me… :)
Hi All,
In the JRE 6 release you had the possibility to download a rpm.bin (for example jre-6u27-linux-i586-rpm.bin) package. This Package seems to have been removed from JRE 7. Anyone any idea?
Hi Bart,
I don’t know reason why rpm.bin packages are removed but plain RPM packages also works nicely… :)
An excellent post…!
I was afraid that I may waste time in setting up JDK on my newly installed Fedora 15.
Through this post, I installed it successfully within 15 minutes.
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?
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
javawscommand.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:
alternatives --config javawshi,
i have openjdk 1.6.0 and jdk 7. i need jdk 6 on my box, do you know how to do remove jdk 7 from my fedora 16 box? thanks.
Hi reza,
So you want to install Oracle Java JDK 6 also? But I don’t understand why you want remove Oracle Java JDK 7? :)
Oh yeah it’s very simple to install java on Linux !!!
Hi under2sea,
I agree, very simple setup… :)
Thanks! Great post & nice site for red eyed linux users.
when i try to type
javaws
the output is no such file or directory.
what should i do? all else is successful except this one.
Hi Joan a,
Did you installed JAVA JRE or JDK and 32-bit or 64-bit?
How do we fix symbolic links?
For example, i got
the primary link for libjavaplugin.so must be /usr/lib/mozilla/plugins/libjavaplugin.so
Hi Newtype,
Could you post exact command and full error message what you try to run?
And please post also output of following commands:
Thanks Jr, the command was
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so \ libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000If I remove the “/”
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000The libjavaplugin.so will appear as an broken symbolic link and the target it was trying to link becomes “/etc/alternatives/libjavaplugin.so.x86_64″
which was trying to link
“/usr/java/latest/jre/amd64/libnpjp2.so”
which is wrong, as the file it was trying to locate is in fact
“/usr/java/latest/lib/amd64/libnpjp2.so”
However, even if the original “/etc/alternatives/libjavaplugin.so.x86_64″ is deleted. The new “/etc/alternatives/libjavaplugin.so.x86_64″ created by the command
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000Will still attempt to link to “”/usr/java/latest/jre/amd64/libnpjp2.so”
Well, what I did now is do a
cp -a lib jre, but I am not sure is this what we are suppose to do.uname -a gives
Linux 3.2.3-2.fc16.x86_64 #1 SMP Fri Feb 3 20:08:08 UTC 2012 x86_64 x86_64 x86_64 GNU/Linuxlsb_release-a gives
LSB Version: :core-4.0-amd64:core-4.0-noarch
Distributor ID: Fedora
Description: Fedora release 16 (Verne)
Release: 16
Codename: Verne
I am using the 64 bit version.
Okay, this looks very messy. The first thing to do is forget all the cp -a jre lib style commands, because they are not really needed! With these you only get a problems.
So are you installing Oracle Java JRE or JDK?
Could you please post output of following commands:
The copy -a command is just a compromised solution I can think of to fix the broken symbolic link. Mozilla do recognise the plugin afterwards and passed the java test, but I guess it only worked because java doesnt care about it.
I only have JRE installed, since I dont really need the stuff in JDK.
And for list command, here is what I got
ls -la /usr/lib64/mozilla/plugins/libjavaplugin.so
/usr/lib64/mozilla/plugins/libjavaplugin.so -> /etc/alternatives/libjavaplugin.so.x86_64ls -la /etc/alternatives/libjavaplugin.so.x86_64
/etc/alternatives/libjavaplugin.so.x86_64 -> /usr/java/latest/jre/amd64/libnpjp2.soObviously, something screwed up here.
ls -la /usr/java
total 40572
drwxr-xr-x. 3 root root 4096 Feb 7 18:45 .
drwxr-xr-x. 14 root root 4096 Nov 10 19:55 ..
lrwxrwxrwx. 1 root root 16 Nov 22 20:48 default -> /usr/java/latest
drwxr-xr-x. 8 root root 4096 Feb 8 17:29 jre1.6.0_30
-rw-r--r--. 1 root root 20904187 Oct 3 19:00 jre-6u29-linux-amd64.rpm
-rwxr-xr-x. 1 root root 20627096 Nov 21 18:11 jre-6u29-linux-x64-rpm.bin
lrwxrwxrwx. 1 root root 21 Feb 7 18:07 latest -> /usr/java/jre1.6.0_30
ls -la /usr/java/latest/lib/amd64/libnpjp2.so
-rwxr-xr-x. 1 root root 80592 Nov 10 17:49 /usr/java/latest/lib/amd64/libnpjp2.sols -la /usr/java/latest/jre/lib/amd64/libnpjp2.so
ls: cannot access /usr/java/latest/jre/lib/amd64/libnpjp2.so: No such file or directoryls -la /usr/java/latest/jre/amd64/libnpjp2.so
-rwxr-xr-x. 1 root root 80592 Nov 10 17:49 /usr/java/latest/jre/amd64/libnpjp2.soYour problem is that the you have installed Java JRE 6, with Java JRE 7 guide…with Java JRE 6 64-bit right alternatives install command is:
More info from Java 6 install guide.
I am afraid that the problem may not be caused by an incorrect command, because the command in question is exactly the same, word by word.
I am using the “latest” method and from what I have gathered, the installation steps for Java 1.6 and 1.7 is exactly the same as well.
Besides, for both 1.6 and 1.7 installation, the command
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000
will generate the corrupted symbolic link libjavaplugin.so.x86_64 in
“/etc/alternatives/”.
In fact, I have done a bit research in regarding to this problem.
The corrupt link can be linked to anywhere. For another instance, the link was incorrectly pointed to “/usr/lin64/mozilla/plugins/libjavaplugin.so” and in my case, it was “/usr/java/latest/jre/amd64/libnpjp2.so”.
The cause of the problem is really caused by a typo when the symbolic link was first made. Unfortunately, after the link is made, it cannot be changed, even if the .so file is deleted and recreated; or perhaps this only occurs in fedora.
The only way to “fix” it, is sadly, changing the java path.
Of course you could change/remove link with alternatives –remove libjavaplugin.so.x86_64 command, like:
If you remove original .so file then you have broken link(s) yes. So you can fix it simply, first remove wrong link and then create right link. One thing to remember, you should never touch (manually with mv, cp, rm, etc. commands) any files which are installed from RPM packages. Or you have soon a Linux system that can’t longer maintain and update.
Steps provided was just what was needed for RHEL newbie learning Linux in more detail. Thanks much and keep up the great work!
jdk7 installation is removing jdk6, how do i keep both?
Hi Dileep,
Try following method to keep both Java JDK 6 and JDK 7, you can of course use same method the other way round, because you have Java JDK 6 installed already.
Thank You.
You are welcome! :)
Thanks for the instructions. Worked like a charm!!!
Thanks for this tutorial, I’m new user in Linux and finally found one that worked. :)
Thanks for this.
Thank You so much it just worked perfectly