Install Sun/Oracle Java JDK/JRE 6u32 on Fedora 16/15, CentOS/RHEL 6.2/5.8

Please note: This guide still working normally if you want install Sun/Oracle Java 6, but if you want latest Java 7 version, then check Howto Install Sun/Oracle Java JDK/JRE 7 on Fedora 16/15, CentOS 6.2/6.1/6/5.8 and Red Hat (RHEL) 6.3/6.2/6.1/6/5.8.
By default, Fedora 16/15/14/13/12 and CentOS/Red Hat (RHEL) 6.3/6.2/6.1/6/5.8 Linux operating systems use the OpenJDK Java, which is a good choice for normal use and it works with almost all the Java programs normally. OpenJDK is also easy to install and maintain with YUM package management, but some cases, Sun/Oracle Java installation is necessary, for example, if some program have to compile with Sun/Oracle Java or a particular program does not work without Sun/Oracle Java.
This is guide, howto install Oracle Java JDK/JRE 6u32 on Fedora 16/15/14/13/12, CentOS/RHEL 6.2/6.1/6/5.8.
Install Sun/Oracle Java JDK /JRE 6u32 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 or JRE RPMs
Download Sun/Oracle Java JDK or JRE from here (current version is JDK 6 Update 32) http://www.oracle.com/technetwork/java/javase/downloads/index.html.
Note: Select rpm.bin package (example jdk-6u32-linux-i586-rpm.bin, jre-6u32-linux-i586-rpm.bin, jdk-6u32-linux-x64-rpm.bin or jre-6u32-linux-x64-rpm.bin).
2. Change to root user.
sudo -i ## OR ## su -
3a. Run Sun/Oracle Java JDK binary
chmod +x /path/to/file/jdk-6u32-linux-*-rpm.bin /path/to/binary/jdk-6u32-linux-*-rpm.bin ## OR ## sh /path/to/binary/jdk-6u32-linux-*-rpm.bin
Note: Use full file name (without asterix) if you have both i586 and x64 versions downloaded.
3b. Run Sun/Oracle Java JRE binary
chmod +x /path/to/file/jre-6u32-linux-*-rpm.bin /path/to/binary/jre-6u32-linux-*-rpm.bin ## OR ## sh /path/to/binary/jre-6u32-linux-*-rpm.bin
Note: Use full file name (without asterix) if you have both i586 and x64 versions downloaded.
4a. Install Sun/Oracle JDK java, javaws, libjavaplugin.so (for Firefox/Mozilla) and javac with alternatives –install command
## java ## alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_32/jre/bin/java 20000 ## javaws (32-bit only) ## alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.6.0_32/jre/bin/javaws 20000 ## Java Browser (Mozilla) Plugin 32-bit ## alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jdk1.6.0_32/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.6.0_32/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.6.0_32/bin/javac 20000 alternatives --install /usr/bin/jar jar /usr/java/jdk1.6.0_32/bin/jar 20000
4b. Install Sun/Oracle JRE java, javaws and libjavaplugin.so (for Firefox/Mozilla) with alternatives –install command
## java ## alternatives --install /usr/bin/java java /usr/java/jre1.6.0_32/bin/java 20000 ## javaws (32-bit only) ## alternatives --install /usr/bin/javaws javaws /usr/java/jre1.6.0_32/bin/javaws 20000 ## Java Browser (Mozilla) Plugin 32-bit ## alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jre1.6.0_32/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.6.0_32/lib/amd64/libnpjp2.so 20000
5. Check current java, javac, javaws and libjavaplugin.so versions
java -version java version "1.6.0_32" Java(TM) SE Runtime Environment (build 1.6.0_32-b04) Java HotSpot(TM) Server VM (build 20.6-b01, mixed mode) javac -version javac 1.6.0_32 javaws Java(TM) Web Start 1.6.0_32 [...]
Note: Check libjavaplugin.so with restarting Mozilla Firefox and writing about:plugins on address bar.
6. Swap between OpenJDK and Sun/Oracle JDK versions
alternatives --config java # or javac or javaws or libjavaplugin.so There are 4 programs which provide 'java'. Selection Command ----------------------------------------------- 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java 2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java * 3 /usr/java/jdk1.6.0_18/jre/bin/java + 4 /usr/java/jdk1.6.0_32/jre/bin/java Enter to keep the current selection[+], or type selection number:
Note: java with [+] is currently on use
Post-Installation Setup
Add JAVA_HOME environment variable to /etc/profile file or $HOME/.bash_profile file
## export JAVA_HOME JDK ## export JAVA_HOME="/usr/java/jdk1.6.0_32" ## export JAVA_HOME JRE ## export JAVA_HOME="/usr/java/jre1.6.0_32"
Related posts:
- Install Sun/Oracle Java JDK/JRE 7u4 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 Adobe Reader on Fedora 16/15, CentOS/RHEL 6.2/5.8
109 Comments
Leave a Comment
Trackbacks/Pingbacks
- Howto Install Sun Java (JDK, JRE) on Fedora, CentOS, Red Hat | if … | Just linux! - [...] Here is the original: Howto Install Sun Java (JDK, JRE) on Fedora, CentOS, Red Hat | if … [...]
- Howto Install Sun Java (JDK, JRE) on Fedora, CentOS, Red Hat | if … | Drakz Free Online Service - [...] here to read the rest: Howto Install Sun Java (JDK, JRE) on Fedora, CentOS, Red Hat | if … ...
- Howto Install Sun Java (JDK, JRE) on Fedora, CentOS, Red Hat | if … | java - [...] więcej: Howto Install Sun Java (JDK, JRE) on Fedora, CentOS, Red Hat | if … a-very-good, centos, ...
- Install NetBeans 6.9 on Fedora, Centos, Red Hat (RHEL) | if not true then false - [...] Sun’s Java, because I think NetBeans works faster with Sun’s Java. Here is the guide, howto install Sun’s Java ...
- CentOS 5.5 Netinstall – Network Installation | if not true then false - [...] Installed CentOS 5.5 Linux Command LineWhat to do next?Install Adobe Flash Player 10 on CentOS 5.5Install Sun Java (JDK, ...
- Install Eclipse SDK 3.6 (Helios) on Fedora 13, CentOS 5.5, RHEL 5.5/6 | If Not True Then False - [...] Ruby on Rails framework).Install Eclipse SDK 3.6 (Helios) on Fedora, CentOS, Red Hat (RHEL)1. Install Sun Java on Fedora, ...
- Fedora NetInstall (Net Install) with gPXE and BFO (boot.fedoraproject.org) | If Not True Then False - [...] Google Chrome Beta or Google Chrome Unstable on Fedora 13Install Adobe Flash Player 10 on Fedora 13Install Sun Java ...
- Upgrade to Fedora 13 from Fedora 12 with Preupgrade | If Not True Then False - [...] Google Chrome Beta or Google Chrome Unstable on Fedora 13Install Adobe Flash Player 10 on Fedora 13Install Sun Java ...
- Red Hat 6 Installation Guide – RHEL 6 Install Screenshots | If Not True Then False - [...] Beta or Google Chrome Unstable on Red Hat (RHEL) 6Install Adobe Flash Player 10 on Red Hat (RHEL) 6Install ...
- Android SDK and Eclipse ADT on Fedora 13, CentOS 5.5, RHEL 5.5/6 | If Not True Then False - [...] Simple Android Test Project1. Preparing Your Development Computer and Install Required softwares1.1 Install Sun/Oracle Java JDK/JRE1.2 Install Eclipse SDK ...
- Mehrere Java-Installationen nebeneinander « linux|n00b - [...] dir diese erstklassige Anleitung zum Thema auf If not True then False an. Dort erfährst du, wie du neben ...
- Install NetBeans IDE 7.0 Beta on Fedora 14/13, CentOS/Red Hat (RHEL) 5.5/6 - [...] Sun’s Java, because I think NetBeans works faster with Sun’s Java. Here is the guide, howto install Sun/Oracle Java ...
- Delicious Bookmarks for December 25th through December 26th « Lâmôlabs - [...] Install Sun/Oracle Java JDK/JRE 6u23 on Fedora 14, CentOS/RHEL 5.5/6 – December 26th ( tags: java linux fedora ...
- Michael's Tech Blog » Configure Juniper VPN connection on Fedora 15 - [...] Install Sun/Oracle Java JDK/JRE 6u25 on Fedora 15, CentOS/RHEL 5.6/6 [...]
- Java Packages - The UNIX and Linux Forums - [...] follow this Install Sun/Oracle Java JDK/JRE 6u27 on Fedora 15, CentOS/RHEL 5.6/6 and you get [...]
- Install Google Chrome with YUM on Fedora 16/15, CentOS/Red Hat (RHEL) 6 - [...] Google Chrome Unstable Web Browser on Fedora 15 64-bit with 32-bit Flash and Oracle Java plugin [...]
- 2 days of utter frustration trying to have java plugins seen by Firefox9 - [...] it said it would likely cause the browser to crash. I followed the last set of instructions from: http://www.if-not-true-then-false.co...-red-hat-rhel/ ...


Sorry to say this, but doesn’t work for me. Firstly, I installed the JRE RPM on Fedora 13 x86_64, and I found out that the paths to the binaries are slightly different for JRE than for JDK (/usr/java/jre1.6.0_22/bin/java; /usr/java/jre1.6.0_22/lib/amd64/libnpjp2.so (64bit, obviously); javaws links back to the directory it’s in, the website says to install the 32bit package for javaws functionality).
But on top of this, even after having configured alternatives with the correct paths, SeaMonkey 2.0.8 doesn’t seem to see the plugin, and the check on the Java site fails. For now I have no idea what else to try.
Hi szal,
Thank you for corrections. I updated this guide to work better with Sun Java JRE version.
And your problem. Do you have any other browser to test the libjavaplugin?
Could you post following command output:
alternatives --display libjavaplugin.soHi JR —
Thanks for the reply. I tried the Java check with Konqueror after making sure that libjavaplugin.so is listed in the Plugins section of the settings. With Konqueror the site shows no result at all, it just switches to a page linking to the installation instructions after being done scanning.
The output of alternatives –display libjavaplugin.so is:
[root@zalle ~]# alternatives --display libjavaplugin.solibjavaplugin.so - status is manual.
link currently points to /usr/java/jre1.6.0_22/lib/amd64/libnpjp2.so
/usr/java/jre1.6.0_22/lib/amd64/libnpjp2.so - priority 20000
Current `best' version is /usr/java/jre1.6.0_22/lib/amd64/libnpjp2.so.
I appreciate your help and hope you have an idea.
Greetings
szal
Hi again szal,
I figure out that where the problem is and I improved this guide more. I even test this clean installed Fedora 13 64-bit, Sun Java JRE 64-bit and with SeaMonkey 2.0.8, Firefox 3.6.12.
So to get Java Plugin to work, do following (as root)
Remove current libjavaplugin with following command:
And then do the alternatives install again, with following command:
Finally restart browser and it should work. :)
Works great, thanks again JR! :)
Works! Thanks!
But I did few things more before Firefox java plugin start working:
# semanage fcontext -a -t execmem_exec_t ‘/usr/lib64/firefox-3.6/firefox’
# chcon -t execmem_exec_t ‘/usr/lib64/firefox-3.6/firefox’
# semanage fcontext -a -t execmem_exec_t ‘/usr/lib64/nspluginwrapper/plugin-config’
# chcon -t execmem_exec_t ‘/usr/lib64/nspluginwrapper/plugin-config’
Best,
Jozsef
Jozsef,
Thanks! I’m using F14 (32-bit) and I installed the JDK etc. But, I was seeing the javaplugin library in the about:plugins page of firefox. So, I followed your instructions and the javaplugin works now.
Maybe a quick note about this in the instructions would be helpful.
Thanks again!
I wanted to thank you for the tutorial and ask permission to write an translated version in my language (romanian) on my blog.
Hi Madalinux, nice to see you here!
Glad to hear that you like this guide. Yes you can write translated version of this tutorial to your blog in your own language. :)
thank you, will do and link to the article I translate :)
For Romanian translation: http://goo.gl/Rp9xe
Thanks Madalinux. :)
I have problems with the version of java
java -version
Error: dl failure on line 508
Error: failed /opt/jdk1.7.0/jre/lib/i386/server/libjvm.so, because /opt/jdk1.7.0/jre/lib/i386/server/libjvm.so: cannot enable executable stack as shared object requires: Permission denied
thanks
Hi edwin,
Do you have installed Sun Java 7?
Do you get some SELinux warning?
You could try following as root:
Great write up by the way!!! really helped me out
I did receive a SELinux warning. I ran “execstack -c /usr/lib64/mozilla/plugins/libjavaplugin.so” as root and that fixed it for me.
—-Here was the SELinux warning—–
Summary:
SELinux is preventing /usr/lib64/firefox-3.6/firefox from making the program
stack executable.
Detailed Description:
The firefox application attempted to make its stack executable. This is a
potential security problem. This should never ever be necessary. Stack memory is
not executable on most OSes these days and this will not change. Executable
stack memory is one of the biggest security problems. BLAH,BLAH,BLAH (I shortened this because really irrelevant)
Allowing Access:
Sometimes a library is accidentally marked with the execstack flag, if you find
a library with this flag you can clear it with the execstack -c LIBRARY_PATH.
Then retry your application. If the app continues to not work, you can turn the
flag back on with execstack -s LIBRARY_PATH.
Hi Kc,
Thanks for the notification and fix!
Did you get this SELinux warning on Fedora 14?
Worked a charm! Please consider doing screencasts demonstrating same. I use screencast-o-matic
thank you!
Dennis
BTW, could you do a write up on how to get google chrome or chromium browser to play nice with java applets?
Jumped the gun. Java is installed.
[user@localhost ~]$ java -version
java version “1.6.0_22″
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)
mozilla about:plugins shows java plugins installed
BUT when I try to run open a java applet I get this err in the terminal:
LoadPlugin: failed to initialize shared library /usr/java/jre1.6.0_22/lib/i386/libnpjp2.so [/usr/java/jre1.6.0_22/lib/i386/libnpjp2.so: cannot enable executable stack as shared object requires: Permission denied]
Can you please help? That error is the same error I got following Oracle’s ‘exact’ instructions. “Exact” because there is a human to mess it up, me. :(
All help appreciated!
Dennis
Hi Dennis,
I think that SELinux is causing this error.
Could you post SELinux error report?
Bingo. SELinux was the problem.
This fixed it.
914 sudo chcon -t execmem_exec_t ‘/usr/lib/firefox-3.6/firefox’
915 echo to set SELINUX params to hopefully allow SOM to work
Java applet now works. Thanks for the pointer and the very helpful info above!
Dennis
Excellent! Nice to hear that you got it working.
sudo chcon -t execmem_exec_t ‘/usr/lib/firefox-3.6/firefox’
above is the key to enable JRE in Firefox ………….i have been working for few days, finally this is the one solve my few days try and errors session
thanks for the advice
Thanks a lot!!!! That works! Very useful article!
Hi,
Thanks for such a wonderful and descriptive post.
I’m facing an issue. After running all the steps mentioned in the post, when I try running the command “javac -version”, I’m getting the following error message:
[root@localhost suraj]# javac -version
bash: javac: command not found…
Similar command is: ‘java’
I’m quite new to Linux, and am using Fedora14. Please provide a solution to this problem
Thanks in advance….
Suraj
Hi Suraj,
Did you install the JRE or JDK?
Thank you for your excellent guide. Great work!
this tutorial really helpful. thanks.
Hi,
Probably I’ve messed up big time… :)
Will try installing from scratch once again…
Congrats!!… this is a really good and comprehensive guide.
Keep up the good work!
I have 64 bit RHEL 6 installed.
Need to use ModJK for Apache and Tomcat.
Installed jdk1.6.0_23 in /usr/java. From Oracles site downloaded jdk-6u23-linux-x64-rpm.bin.
One of the instructions is to insert this in the /etc/httpd/conf/workers.properties file:
# Unix – Sun VM or blackdown
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps)i386$(ps)server$(ps)libjvm.so
I only have the libjvm.so in:
/usr/java/jdk1.6.0_23/jre/lib/amd64 ??????? I have a x86_64 Xeon. I presume ‘amd64′ doesny mean it is a amd processor??
Is this the correct file for Redhat 6 64 bit? Should I ask Oracle instead?
Hi Barrie,
Amd64 should work OK with Xeon I guess, but this
Need little modification, it should maybe look following:
And here is therefore expected that you have:
workers.java_home variable with /usr/java/jdk1.6.0_23/
and
ps variable with /
This guide is simply the best!
Cheers!
You forgot jar.
alternatives –install /usr/bin/jar jar $JAVA_HOME/bin/jar 20000
You can always do `java -jar` :)
Whenever I try to install the JDK (either the rpm.bin file or the .bin file) I run into the following problem:
./jdk-6u24-linux-x64.bin: line 26: 4483 Aborted (core dumped) “$javaprefix/bin/java” com.sun.servicetag.Installer -source “$source” “$register_option” > /dev/null 2>&1
Please note that I am using Fedora 14 x64 distro.
Has anybody run into this problem?
Hi!
Yes. I Solved this problem. Exit you X-Server and start install in to console
Fedora 15
What is it with Linux people and the Copy-Paste religion? Why the insistance on providing “recipes” (series of instructions) that the users then must copy and paste. Why not just provide a BASH SCRIPT for download, that does all the work?.
The users can then open the bash script and see what it does, too.
FC
Hi Fernando nice to see you here,
Heh, Copy-Paste religion yes… :)
For me at least it’s much more important to actually see what is really happening when I install something. If I use bash script to install something and it works like a charm then I’m probably not interested how program was really installed.
Other drawbacks if using Bash scripts is the fact that, because they need usually root user permission, so for example, rootkits and other trash is very easy to install users computer. By the way this is one reason why Windows is sooooo vulnerable, because people install programs with installers from the Internet and don’t know what is really happening when they click “Yes” or “Ok”.
And some cases bash scripts might be very complicated and have so many options that it is more difficult and time consuming use bash script than run just needed commands using copy-paste method.
And yes this is my opinion on this bash script thing, but I of course understand your point. :D
This is the best install that I have found. Thanks for doing this and keeping it up to date.
Can you please explain a few things? I ran the rpm.bin from /usr/lib/jvm/ and that put a bunch of rpms in that directory. At first I didn’t understand that the install also put the jdk in /usr/java/. Why didn’t I have to run the rpm command? Did it install anything any place else, and if so what was it? Do I need to run the rpm command? Can I remove the rpms or are they being used or needed in the future?
Thanks,
Josh
Hi Josh,
Thanks for the compliments!
Actually this rpm.bin package is installer which installs Java and it runs internally needed RPM commands. Yes, your JDK or JRE is installed on /usr/java directory.
And you don’t need to run any rpm commands when you use installer and you don’t need installer (rpm.bin) or RPM’s after installation and you can remove those.
Personally I install new JDK version when it comes and then remove old versions later. And installing new versions you can use exactly same method. And I try to keep this guide up-to-date, with OS versions and Java versions…
Thank you. Excelent descriptions.
Hi,
I can’t get this to work. When I use about:plugins in firefox, the java one is not listed. I am using fedora 14, and when I type “alternatives –display libjavaplugin.so” nothing happens.
Thanks
Hi Godzilla’s Mistress,
Did you run some of following command (depending on your system 32-bit or 64-bit and installation JRE or JDK)
i have the same problem When I use about:plugins in firefox, the java one is not listed. I am using fedora 14 64bits, and when I type “alternatives –display libjavaplugin.so” nothing happens.
im already do this….
## JRE and 64-bit Linux ##
alternatives –install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jre1.6.0_24/lib/amd64/libnpjp2.so 20000
PLease help..
Hi raul,
I can get libjavaplugin.so.x86_64 working on Fedora 14 (64-bit) system.
Could out post output of following commands:
[root@lenovo raul]# ls -la /usr/java/jre1.6.0_24/lib/amd64/libnpjp2.so
-rwxr-xr-x. 1 root root 81456 feb 2 19:30 /usr/java/jre1.6.0_24/lib/amd64/libnpjp2.so
[root@lenovo raul]# alternatives –display libjavaplugin.so.x86_64
libjavaplugin.so.x86_64 – el estado es automático.
el enlace apunta actualmente a /usr/java/jdk1.6.0_23/jre/lib/amd64/libnpjp2.so
/usr/java/jdk1.6.0_23/jre/lib/amd64/libnpjp2.so – prioridad 20000
/usr/java/jdk1.6.0_24/jre/lib/amd64/libnpjp2.so – prioridad 20000
/usr/java/jre1.6.0_24/lib/amd64/libnpjp2.so – prioridad 20000
/usr/java/default/lib/amd64/libnpjp2.so – prioridad 20000
/usr/java/jre1.6.0_23/lib/amd64/libnpjp2.so – prioridad 20000
La ‘mejor’ versión actual es /usr/java/jdk1.6.0_23/jre/lib/amd64/libnpjp2.so.
[root@lenovo raul]#
http://i286.photobucket.com/albums/ll113/lukeraza/screen.png
Hi again raul,
Please try following:
alternatives --config libjavaplugin.so.x86_64And select latest (and right) number from list. Then restart Firefox and check about:plugins again.
Hi JR,
Thanks for your time,
Now, i just have 1 simbolic link but i can’t, when performing the Firefox check using “about:plugins”, no java plugins are listed
please check this picture.
http://i286.photobucket.com/albums/ll113/lukeraza/java.png
Hi again raul,
Actually your problems sounds now SELinux problem, so try run following command as root:
Then restart Firefox and check about:plugins again. Is it working?
Hi JR,
Now everything it’s running.
Thank you so much. You’re the best.
Raul.
I am having the same problem that GM had with F14 — Sun JRE installation does not provide the java plugin for Firefox. When performing the Firefox check using “about:plugins”, no java plugins are listed. This is true regardless of whether I enable the default OpenJDK or the newly installed Oracle JRE as my default java installation.
I am using an x86_64 system on a fresh install of Scientific Linux 6.0 with the latest updates. Yes, I did perform the following:
## JRE and 64-bit Linux ##alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jre1.6.0_24/lib/amd64/libnpjp2.so 20000
For reference:
# alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
*+ 2 /usr/java/jre1.6.0_24/bin/java
# java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
# javaws
Java(TM) Web Start 1.6.0_24
The version of Firefox provided is 3.6.14.
Hi bob,
I can get libjavaplugin.so.x86_64 working on 64-bit system.
Could out post output of following commands:
To use alternatives system properly you have to issue following commands:
javaver=1.6.0
mkdir /usr/lib/jvm-exports/java-${javaver}-sun;
(
cd /usr/lib/jvm-exports/java-${javaver}-sun;
ln -s /usr/java/default/jre/lib/rt.jar jaas-${javaver}.jar
ln -s /usr/java/default/jre/lib/jce.jar jce-${javaver}.jar
ln -s /usr/java/default/jre/lib/rt.jar jdbc-stdext-${javaver}.jar
ln -s /usr/java/default/jre/lib/rt.jar jdbc-stdext-3.0.jar
ln -s /usr/java/default/jre/lib/rt.jar jndi-${javaver}.jar
ln -s /usr/java/default/jre/lib/rt.jar jndi-cos-${javaver}.jar
ln -s /usr/java/default/jre/lib/rt.jar jndi-ldap-${javaver}.jar
ln -s /usr/java/default/jre/lib/rt.jar jndi-rmi-${javaver}.jar
ln -s /usr/java/default/jre/lib/jsse.jar jsse-${javaver}.jar
ln -s /usr/java/default/jre/lib/rt.jar sasl-${javaver}.jar
ln -s jaas-${javaver}.jar jaas.jar
ln -s jce-${javaver}.jar jce.jar
ln -s jdbc-stdext-${javaver}.jar jdbc-stdext.jar
ln -s jndi-${javaver}.jar jndi.jar
ln -s jndi-cos-${javaver}.jar jndi-cos.jar
ln -s jndi-ldap-${javaver}.jar jndi-ldap.jar
ln -s jndi-rmi-${javaver}.jar jndi-rmi.jar
ln -s jsse-${javaver}.jar jsse.jar
ln -s sasl-${javaver}.jar sasl.jar
)
mkdir /usr/lib/jvm-exports/jre-${javaver}-sun;
(
cd /usr/lib/jvm-exports/jre-${javaver}-sun;
ln -s /usr/java/default/lib/rt.jar jaas-${javaver}.jar
ln -s /usr/java/default/lib/jce.jar jce-${javaver}.jar
ln -s /usr/java/default/lib/rt.jar jdbc-stdext-${javaver}.jar
ln -s /usr/java/default/lib/rt.jar jdbc-stdext-3.0.jar
ln -s /usr/java/default/lib/rt.jar jndi-${javaver}.jar
ln -s /usr/java/default/lib/rt.jar jndi-cos-${javaver}.jar
ln -s /usr/java/default/lib/rt.jar jndi-ldap-${javaver}.jar
ln -s /usr/java/default/lib/rt.jar jndi-rmi-${javaver}.jar
ln -s /usr/java/default/lib/jsse.jar jsse-${javaver}.jar
ln -s /usr/java/default/lib/rt.jar sasl-${javaver}.jar
ln -s jaas-${javaver}.jar jaas.jar
ln -s jce-${javaver}.jar jce.jar
ln -s jdbc-stdext-${javaver}.jar jdbc-stdext.jar
ln -s jndi-${javaver}.jar jndi.jar
ln -s jndi-cos-${javaver}.jar jndi-cos.jar
ln -s jndi-ldap-${javaver}.jar jndi-ldap.jar
ln -s jndi-rmi-${javaver}.jar jndi-rmi.jar
ln -s jsse-${javaver}.jar jsse.jar
ln -s sasl-${javaver}.jar sasl.jar
)
# Java SDK
alternatives --install /usr/bin/javac javac /usr/java/default/bin/javac 32000 \
--slave /usr/lib/jvm/java java_sdk /usr/java/default \
--slave /usr/lib/jvm-exports/java java_sdk_exports /usr/lib/jvm-exports/java-${javaver}-sun \
--slave /usr/bin/appletviewer appletviewer /usr/java/default/bin/appletviewer \
--slave /usr/bin/apt apt /usr/java/default/bin/apt \
--slave /usr/bin/extcheck extcheck /usr/java/default/bin/extcheck \
--slave /usr/bin/jar jar /usr/java/default/bin/jar \
--slave /usr/bin/jarsigner jarsigner /usr/java/default/bin/jarsigner \
--slave /usr/bin/javadoc javadoc /usr/java/default/bin/javadoc \
--slave /usr/bin/javah javah /usr/java/default/bin/javah \
--slave /usr/bin/javap javap /usr/java/default/bin/javap \
--slave /usr/bin/jconsole jconsole /usr/java/default/bin/jconsole \
--slave /usr/bin/jdb jdb /usr/java/default/bin/jdb \
--slave /usr/bin/jhat jhat /usr/java/default/bin/jhat \
--slave /usr/bin/jinfo jinfo /usr/java/default/bin/jinfo \
--slave /usr/bin/jmap jmap /usr/java/default/bin/jmap \
--slave /usr/bin/jps jps /usr/java/default/bin/jps \
--slave /usr/bin/jrunscript jrunscript /usr/java/default/bin/jrunscript \
--slave /usr/bin/jsadebugd jsadebugd /usr/java/default/bin/jsadebugd \
--slave /usr/bin/jstack jstack /usr/java/default/bin/jstack \
--slave /usr/bin/jstat jstat /usr/java/default/bin/jstat \
--slave /usr/bin/jstatd jstatd /usr/java/default/bin/jstatd \
--slave /usr/bin/jvisualvm jvisualvm /usr/java/default/bin/jvisualvm \
--slave /usr/bin/native2ascii native2ascii /usr/java/default/bin/native2ascii \
--slave /usr/bin/rmic rmic /usr/java/default/bin/rmic \
--slave /usr/bin/schemagen schemagen /usr/java/default/bin/schemagen \
--slave /usr/bin/serialver serialver /usr/java/default/bin/serialver \
--slave /usr/bin/wsgen wsgen /usr/java/default/bin/wsgen \
--slave /usr/bin/wsimport wsimport /usr/java/default/bin/wsimport \
--slave /usr/bin/xjc xjc /usr/java/default/bin/xjc \
--slave /usr/share/man/man1/appletviewer.1 appletviewer.1 /usr/java/default/man/man1/appletviewer.1 \
--slave /usr/share/man/man1/apt.1 apt.1 /usr/java/default/man/man1/apt.1 \
--slave /usr/share/man/man1/extcheck.1 extcheck.1 /usr/java/default/man/man1/extcheck.1 \
--slave /usr/share/man/man1/jar.1 jar.1 /usr/java/default/man/man1/jar.1 \
--slave /usr/share/man/man1/jarsigner.1 jarsigner.1 /usr/java/default/man/man1/jarsigner.1 \
--slave /usr/share/man/man1/javac.1 javac.1 /usr/java/default/man/man1/javac.1 \
--slave /usr/share/man/man1/javadoc.1 javadoc.1 /usr/java/default/man/man1/javadoc.1 \
--slave /usr/share/man/man1/javah.1 javah.1 /usr/java/default/man/man1/javah.1 \
--slave /usr/share/man/man1/javap.1 javap.1 /usr/java/default/man/man1/javap.1 \
--slave /usr/share/man/man1/jconsole.1 jconsole.1 /usr/java/default/man/man1/jconsole.1 \
--slave /usr/share/man/man1/jdb.1 jdb.1 /usr/java/default/man/man1/jdb.1 \
--slave /usr/share/man/man1/jhat.1 jhat.1 /usr/java/default/man/man1/jhat.1 \
--slave /usr/share/man/man1/jinfo.1 jinfo.1 /usr/java/default/man/man1/jinfo.1 \
--slave /usr/share/man/man1/jmap.1 jmap.1 /usr/java/default/man/man1/jmap.1 \
--slave /usr/share/man/man1/jps.1 jps.1 /usr/java/default/man/man1/jps.1 \
--slave /usr/share/man/man1/jrunscript.1 jrunscript.1 /usr/java/default/man/man1/jrunscript.1 \
--slave /usr/share/man/man1/jsadebugd.1 jsadebugd.1 /usr/java/default/man/man1/jsadebugd.1 \
--slave /usr/share/man/man1/jstack.1 jstack.1 /usr/java/default/man/man1/jstack.1 \
--slave /usr/share/man/man1/jstat.1 jstat.1 /usr/java/default/man/man1/jstat.1 \
--slave /usr/share/man/man1/jstatd.1 jstatd.1 /usr/java/default/man/man1/jstatd.1 \
--slave /usr/share/man/man1/native2ascii.1 native2ascii.1 /usr/java/default/man/man1/native2ascii.1 \
--slave /usr/share/man/man1/rmic.1 rmic.1 /usr/java/default/man/man1/rmic.1 \
--slave /usr/share/man/man1/schemagen.1 schemagen.1 /usr/java/default/man/man1/schemagen.1 \
--slave /usr/share/man/man1/serialver.1 serialver.1 /usr/java/default/man/man1/serialver.1 \
--slave /usr/share/man/man1/wsgen.1 wsgen.1 /usr/java/default/man/man1/wsgen.1 \
--slave /usr/share/man/man1/wsimport.1 wsimport.1 /usr/java/default/man/man1/wsimport.1 \
--slave /usr/share/man/man1/xjc.1 xjc.1 /usr/java/default/man/man1/xjc.1
alternatives --install /usr/lib/jvm/java-sun java_sdk_sun /usr/java/default 32000 \
--slave /usr/lib/jvm-exports/java-sun java_sdk_sun_exports /usr/lib/jvm-exports/java-${javaver}-sun
alternatives --install /usr/lib/jvm/java-${javaver} java_sdk_${javaver} /usr/java/default 32000 \
--slave /usr/lib/jvm-exports/java-${javaver} java_sdk_${javaver}_exports /usr/lib/jvm-exports/java-${javaver}-sun
# Java Runtime Environment
alternatives --verbose --install /usr/bin/java java /usr/java/default/jre/bin/java 32000 \
--slave /usr/lib/jvm/jre jre /usr/java/default/jre \
--slave /usr/lib/jvm-exports/jre jre_exports /usr/lib/jvm-exports/jre-${javaver}-sun \
--slave /usr/bin/javaws javaws /usr/java/default/bin/javaws \
--slave /usr/bin/ControlPanel ControlPanel /usr/java/default/bin/ControlPanel \
--slave /usr/bin/keytool keytool /usr/java/default/bin/keytool \
--slave /usr/bin/orbd orbd /usr/java/default/bin/orbd \
--slave /usr/bin/pack200 pack200 /usr/java/default/bin/pack200 \
--slave /usr/bin/policytool pack200 /usr/java/default/bin/policytool \
--slave /usr/bin/rmid rmid /usr/java/default/bin/rmid \
--slave /usr/bin/rmiregistry rmiregistry /usr/java/default/bin/rmiregistry \
--slave /usr/bin/servertool servertool /usr/java/default/bin/servertool \
--slave /usr/bin/tnameserv tnameserv /usr/java/default/bin/tnameserv \
--slave /usr/bin/unpack200 unpack200 /usr/java/default/bin/unpack200 \
--slave /usr/share/man/man1/java.1 java.1 /usr/java/default/man/man1/java.1 \
--slave /usr/share/man/man1/keytool.1 keytool.1 /usr/java/default/man/man1/keytool.1 \
--slave /usr/share/man/man1/orbd.1 orbd.1 /usr/java/default/man/man1/orbd.1 \
--slave /usr/share/man/man1/pack200.1 pack200.1 /usr/java/default/man/man1/pack200.1 \
--slave /usr/share/man/man1/policytool.1 policytool.1 /usr/java/default/man/man1/policytool.1 \
--slave /usr/share/man/man1/rmid.1 rmid.1 /usr/java/default/man/man1/rmid.1 \
--slave /usr/share/man/man1/rmiregistry.1 rmiregistry.1 /usr/java/default/man/man1/rmiregistry.1 \
--slave /usr/share/man/man1/servertool.1 servertool.1 /usr/java/default/man/man1/servertool.1 \
--slave /usr/share/man/man1/tnameserv.1 tnameserv.1 /usr/java/default/man/man1/tnameserv.1 \
--slave /usr/share/man/man1/unpack200.1 unpack200.1 /usr/java/default/man/man1/unpack200.1
alternatives --verbose --install /usr/lib/jvm/jre-sun jre_sun /usr/java/default/jre 32000 \
--slave /usr/lib/jvm-exports/jre-sun jre_sun_exports /usr/lib/jvm-exports/jre-${javaver}-sun
alternatives --verbose --install /usr/lib/jvm/jre-${javaver} jre_${javaver} /usr/java/default/jre 32000 \
--slave /usr/lib/jvm-exports/jre-${javaver} jre_${javaver}_exports /usr/lib/jvm-exports/jre-${javaver}-sun
# Java browser plugin
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/default/jre/lib/i386/libnpjp2.so 32000
unset javaver
[code]# ls -la /usr/java/jre1.6.0_24/lib/amd64/libnpjp2.so && alternatives --display libjavaplugin.so.x86_64
-rwxr-xr-x. 1 root root 81456 Feb 2 19:30 /usr/java/jre1.6.0_24/lib/amd64/libnpjp2.so
libjavaplugin.so.x86_64 - status is auto.
link currently points to /usr/java/jdk1.6.0_24/jre/lib/amd64/libnpjp2.so
/usr/java/jdk1.6.0_24/jre/lib/amd64/libnpjp2.so - priority 20000
/usr/java/jre1.6.0_24/lib/amd64/libnpjp2.so - priority 20000
Current `best' version is /usr/java/jdk1.6.0_24/jre/lib/amd64/libnpjp2.so.[/code]
Hi bob,
Actually this sounds SELinux problem so try run following command as root:
And restart Firefox.
I’ve been trying like heck to get this working because I need Java for work, but I can’t seem to make any progress no matter what I try.
I get the following:
[jason@peregrine ~]$ java -version
java version "1.6.0_24"
[jason@peregrine ~]$ javac -version
javac 1.6.0_24
[jason@peregrine ~]$ ls -la /usr/java/jre1.6.0_24/lib/amd64/libnpjp2.so
-rwxr-xr-x. 1 root root 81456 Feb 2 20:30 /usr/java/jre1.6.0_24/lib/amd64/libnpjp2.so
[jason@peregrine ~]$ alternatives --display libjavaplugin.so.x86_64
libjavaplugin.so.x86_64 - status is manual.
link currently points to /usr/java/jre1.6.0_24/lib/amd64/libnpjp2.so
/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/lib/amd64/IcedTeaPlugin.so - priority 16000
/usr/java/default/lib/amd64/libnpjp2.so - priority 20000
/usr/java/jre1.6.0_24/lib/amd64/libnpjp2.so - priority 20000
Current `best' version is /usr/java/default/lib/amd64/libnpjp2.so.
But I get nothing in FF 3.6, FF 4, or Chrome. Anyone have any ideas?
Hi jjw3579,
Try run following as root:
Scientific Linux 6.0: 64-bit
Regarding my earlier installation failure on 64-bit Scientific Linux 6.0 and your proposed solution based on SEL: I had SELinux configured in permissive mode, so I am inclined to think that SEL isn’t the root of the problem. I am not working on the SL6 box at present, so I cannot pursue your proposed solution right now.
<Fedora 14: 64-bit
I am presently trying to perform your 64-bit JRE installation method on a fresh install of Fedora 14 with all of the current updates. I have followed your 64-bit instructions but I am still having problems. It looks like Java Web Start is not being installed:
# java -versionjava version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
# javac -version
-bash: javac: command not found
# javaws
-bash: javaws: command not found
# alternatives --config java
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
*+ 2 /usr/java/jre1.6.0_24/bin/java
Enter to keep the current selection[+], or type selection number:
I understand that javac should not be installed when I am installing a JRE.
What about javaws?
Looking at your instructions, the 64-bit installation instructions do not appear to include a command that installs javaws. In section 4b, you have provided installation instructions for javaws on 32-bit platforms but not on 64-bit platforms. Is there a similar installation instruction that needs to be performed on 64-bit platforms?
I also thought I’d point out that the Post-Installation Setup section of the guide appears correct for users of the JDK but doesn’t seem correct for people installing the JRE.
Thanks for your help.
Hi bob,
Sun Java 64-bit version does not provide javaws, that’s why there is no installation instructions for that.
I fixed post-installation setup, added also JRE.
I installed jdk 1.6.0_30 64bit and execute
ls /usr/java/jdk1.6.0_30/bin
and I find “javaws”
Forgot to mention: the 64-bit installation on F14 is also not providing the Firefox plugin. about:config lists no java plugins for Firefox 3.6.16.
Hi bob,
Oracle Java 64-bit installation does provide Mozilla plugin, please post output of following commands:
alternatives --display libjavaplugin.so.x86_64Check also that the Java plugin really exists and check your /var/log/audit/audit.log for SELinux messages.
Hi, everyone, i would really appreciate if someone can give me an advice about this problem that is driving me crazy.
I’ve installed Fedora 14 (Laughlin), and successfully installed JDK (following steps above), but sometimes (not always) when i execute Eclipse or Netbeans or Glassfish, a kill signal is send to the process because java runtime had an error (see error below).
Thanks in advance for the help,
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f602dca3761, pid=4054, tid=140051033437952
#
# JRE version: 6.0_25-b06
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.0-b11 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V [libjvm.so+0x656761] PhaseLive::compute(unsigned)+0×241
#
# An error report file with more information is saved as:
# /opt/apache-tomcat/bin/hs_err_pid4054.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
When I tipe sh jdk-6u25-linux-i586-rpm.bin, after pressing enter the error is:
jdk-6u25-linux-i586-rpm.bin: line 94: 3128 Annullato (core dumped) “$javaprefix/bin/java” com.sun.servicetag.Installer -source “$source” “$register_option” > /dev/null 2>&1
Done.
How can I solve this?
Hi Francesco,
Actually your installation is OK, but you (and also I) got this with jdk-6u25-linux-i586-rpm.bin and jdk-6u25-linux-x64-rpm.bin because installer maybe try to open browser and failed. So you could continue your installation and get JDK working… :)
unfortunately, it does not work for me. I am sure its somehow the configuration on my side.
and I would appreciate some step by step help.
I updated my Fedora 14 to 15. I have a x64 laptop. Firefox is 4.0.1. I followed instruction, even with different version of Java, but it didn’t help.
weird thing is “alternatives –display libjavaplugin.so” does not return any thing.
Please help.
Hi Mike,
Did you run:
Very nice JR. Excellent work!!!!
Trying to install latest version (this morning) of JRE6u26 on a clean (last night), updated (just now) install of Fedora 15, using your instructions. When I hit 3b, I get the following error:
./jre-6u26-linux-i586-rpm.bin: ./install.sfx.1796: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
Poking around, I find that this error is usually associated with out of date applications, but that doesn’t seem to be the case here.
I hate to ask anyone to help me debug my system online, but I’d appreciate any ideas you have.
Hi Steve,
Could you post following info:
and
Here it is:
sshervais@Fedora ~]$ uname -a
Linux Fedora 2.6.38.8-32.fc15.x86_64 #1 SMP Mon Jun 13 19:49:05 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
[sshervais@Fedora ~]$ ls -lt /lib/ld-linux*
ls: cannot access /lib/ld-linux*: No such file or directory
Thanks for the help
Hi again Steve,
Try to install 64-bit version of JRE, because you have 64-bit version of Fedora. So download x64 package, not i586. I think this should solve your problem, but please let me know, if you get it installed or have any other problems.
THANK YOU!
Worked like a charm. I think the problem was I got confused by the Oracle advice to install the 32-bit version. When I followed your instructions, everything Just Worked.
Thanks again.
Steve
You’re welcome! Nice to hear that you get it working! :)
I have fresh installed Fedora 14 with Firefox 3.6.10 and then installed jdk-6u26-linux-i586-rpm.bin in /usr/java dir. I have exactly issued alternatives –install commands for jdk 32-bits as in your guide.
Output of alternatives –display libjavaplugin.so:
libjavaplugin.so – status is auto.
link currently points to /usr/java/jdk1.6.0_26/jre/lib/i386/libnpjp2.so
/usr/lib/jvm/jre-1.6.0-openjdk/lib/i386/IcedTeaPlugin.so – priority 16000
/usr/java/jdk1.6.0_26/jre/lib/i386/libnpjp2.so – priority 20000
Current `best’ version is /usr/java/jdk1.6.0_26/jre/lib/i386/libnpjp2.so.
But about:plugins does not show browser plugins.
Waiting for your further guidance.
DPP
Hi DPP,
This sounds SELinux problem, try run following:
Hi JR
Your diagnosis has worked!!
I appreciate your in depth knowledge in Linux.
My come come back to you in future.
Hi again DPP,
Excellent! You’re always welcome back!
I backed up the disk partition for Fedora 10 successfully using PING (Partimage Is Not Ghost). But PING can not backup the lvm2 partition for fedora 14. Can I backup Fedora 14 partition using Fedora 15 live CD or by any other disk partition backup utility?
DPP
Hi DPP,
Try Clonezilla, should work with lvm2 partitions. :)
Thank you!
Hello. I am a new user to Linux, and I use Fedora 15. I have followed your steps for the jre pack.
I installed everything that’s necessary for it, but here is the problem.
Firefox doesn’t pick it up. So, I went to firefox plugin directory, and found libjavaplugin.so and found out that the link is broken.
I clicked on the file, and it said
“This link cannot be used, because its target “/etc/alternatives/libjavaplugin.so” doesn’t exist.”
So, I went there, and found out a file with the same name. And it in turn said.
“This link cannot be used, because its target “/usr/java/jdk1.6.0_27/jre/lib/i386/libnpjp2.so” doesn’t exist”
I went there is no –jdk1.6.0_27– Why is it happening so?
Hi Jariski,
So you tried to install JRE? Did you followed exactly just JRE part of guide or did you run some JDK commands?
For the last instruction
export JAVA_HOME=”/usr/java/jdk1.6.0_29″
I need to edit the file every time I swap the jdk version? Any better way for this?
Hi Glenn Lee Kian Giap,
Could you first post output of following command:
the output is not related to jdk1.6.0_29 because I have wipe out the previous VM and re-install using a clean CentOS
Let me demonstrate what I was confused by,
I follow this guide to install jdk1.6.0_30, I did the following:
chmod +x /path/to/file/jdk-6u30-linux-*-rpm.bin
/path/to/binary/jdk-6u30-linux-*-rpm.bin
alternatives –install /usr/bin/java java /usr/java/jdk1.6.0_30/jre/bin/java 20000
alternatives –install /usr/bin/javac javac /usr/java/jdk1.6.0_30/bin/javac 20000
then, I follow your jdk 7 installation guide, I did the following:
rpm -Uvh /path/to/binary/jdk-7u2-linux-i586.rpm
alternatives –install /usr/bin/java java /usr/java/jdk1.7.0_02/jre/bin/java 20000
alternatives –install /usr/bin/javac javac /usr/java/jdk1.7.0_02/bin/javac 20000
After the installation, I didn’t export JAVA_HOME.
then, I use alternatives to pick my java and javac version:
# /usr/sbin/alternatives –config java
There are 4 programs which provide ‘java’.
Selection Command
———————————————–
1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
2 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 3 /usr/java/jdk1.6.0_30/jre/bin/java
4 /usr/java/jdk1.7.0_02/jre/bin/java
Enter to keep the current selection[+], or type selection number: 3
# /usr/sbin/alternatives –config java
There are 4 programs which provide ‘java’.
Selection Command
———————————————–
1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
2 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 3 /usr/java/jdk1.6.0_30/jre/bin/java
4 /usr/java/jdk1.7.0_02/jre/bin/java
Enter to keep the current selection[+], or type selection number: 3
# /usr/sbin/alternatives –config javac
There are 2 programs which provide ‘javac’.
Selection Command
———————————————–
*+ 1 /usr/java/jdk1.6.0_30/bin/javac
2 /usr/java/jdk1.7.0_02/bin/javac
Enter to keep the current selection[+], or type selection number: 1
then, I check my java and javac version:
# java -version
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)
# javac -version
javac 1.7.0_02
Sorry, I am newbie, I want to clarify the purpose of the command “alternatives –config java”(or javac)
and is the above return from command “java -version” and “javac -version” expected, I mean I have pick 1.6.0_30, but this 2 commands still give me 1.7.0_02
———————
Between, I issue the command you requested, not sure whether it helps:
# ls -la /usr/java
total 32
drwxr-xr-x 3 root root 4096 Dec 20 23:24 .
drwxr-xr-x 16 root root 4096 Nov 18 05:41 ..
lrwxrwxrwx 1 root root 16 Dec 20 18:30 default -> /usr/java/latest
drwxr-xr-x 8 root root 4096 Dec 20 23:24 jdk1.7.0_02
lrwxrwxrwx 1 root root 21 Dec 20 23:24 latest -> /usr/java/jdk1.7.0_02
Thanks for your help !
I read the result from
ls -la /usr/javaIt seems like my jdk1.6.0_30 being removed by the installation process of jdk1.7.0_02
I am very confuse now? I can’t keep both jdk at the same time?
I assume that my jdk1.6.0_30 was removed by the installation of jdk1.7.0_02, so I execute the following command to swap jdk version to open jdk:
# /usr/sbin/alternatives –config java
There are 4 programs which provide ‘java’.
Selection Command
———————————————–
+ 1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
2 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
* 3 /usr/java/jdk1.6.0_30/jre/bin/java
4 /usr/java/jdk1.7.0_02/jre/bin/java
Enter to keep the current selection[+], or type selection number: 1
# java -version
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)
But the result is still jdk1.7.0
?.?
I found that this is because the /usr/bin/java is not pointing to /etc/alternatives/java, which is pointing to the jdk selected from “alternatives –config java”
How can I solve this ?
I redo the jdk 1.6 installation with clean CentOS
found that /usr/bin/java is pointing /etc/alternative/java
After I complete jdk 1.7 installation
/usr/bin/java pointing /usr/java/default/bin/java
So, the problem occur after installation of jdk 1.7
How should I solve it ? manage the symbolic link manually ?
Sorry for posting so many comment replies because I am keep trying to find the solution, and share all the findings.
For step4a.
“## java ##
alternatives –install /usr/bin/java java /usr/java/jdk1.6.0_29/jre/bin/java 20000″
Will it be better if
alternatives –install /etc/alternative/java java /usr/java/jdk1.6.0_29/jre/bin/java 20000″
because originally the symbolic link is in this way
/usr/bin/java -> /etc/alternative/java -> jdk_path
Hi again Glenn,
Why do you think that it would be?
On alternatives system, the primary link for java must be /usr/bin/java
Did you even try your own suggestion? :)
Oops, sorry about that. I submitted a bit earlier while trying, I was confuse by the symbolic link that time.
Hi Glenn,
If you want to run both Java JDK 6 and Java JDK 7 at the same time on CentOS, then do following:
1. Install Java JDK 7
2. Verify that your Java 7 JDK installation is working as it should be
3. Download Java JDK 6 select this time .bin package (not rpm.bin).
4. Make your jdk-6u30-linux-i586.bin file executable:
5. Change directory to /opt and run .bin file:
6. Check that jdk1.6.0_30 is on /opt directory:
7. Setup Java 6 JDK with alternatives install command:
You are done!
Then when you want change between Java 6 and Java 7 use simply alternatives –config command:
And yes with alternatives system you can easily run multiple versions of Java, but with rpm package management you can install just one Java. So you can have all Java 6 versions installed from u1, u2…u30 and all Java 7 versions installed (u1,u2…), and then you could have same time have OpenJDK 6 and OpenJDK 7 installed and so on…no problem at all…
I hope this clarifies this issue and help you use Java 6 and Java 7 at the same time … :)
If you have some problems feel free to ask… ;)
Thanks a lot of your help!
Another issue is that (with or without installing jdk 1.6), after I have completed jdk 1.7 installation /usr/bin/java pointing /usr/java/default/bin/java which causes swapping jdk version using “alternatives –config java” doesn’t give the correct result when “java -version”. The reason behind is because /usr/bin/java need to point to /etc/alternative/java.
Should I just re-create the symbolic link myself?
Now I feel that the jdk1.6 rpm.bin file installation from official website is actually giving a correct installation, the problem is on jdk1.7
Just the first I have to say that Java 7 installation do not have (at least currently) any problems, I have used exactly same method dozens of times. So if your /usr/bin/java is pointing to /usr/java/default/bin/java, then you have not followed my guide, because my guide does not even use /usr/java/default/bin/java anywhere?
Please could you post output of following commands:
Hi JR, thank you for this blog, I couldnt get mine to work too, and was about to post a question, when I saw your answer to Raul, I am running KDE PLASMA on Fedora 16. It is the firewall issue, where you suggested this command chcon -t execmem_exec_t ‘/usr/lib64/firefox-3.6/firefox’
only here is firefox 9 so needs to be changed to chcon -t execmem_exec_t ‘/usr/lib64/firefox/firefox’
And this was also the issue
*+ 1 /usr/java/jre1.6.0_22/lib/amd64/libnpjp2.so
2 /usr/java/jdk1.6.0_30/jre/lib/amd64/libnpjp2.so
Enter to keep the current selection[+], or type selection number: 2
[root@localhost feodor]# alternatives –config libjavaplugin.so.x86_64
There are 2 programs which provide ‘libjavaplugin.so.x86_64′.
Selection Command
———————————————–
* 1 /usr/java/jre1.6.0_22/lib/amd64/libnpjp2.so
+ 2 /usr/java/jdk1.6.0_30/jre/lib/amd64/libnpjp2.so
I changed to number two, and everything was finally working, in Opera and FF
Thank you again, without you I would go insane.
Hi eurofalcon,
You are welcome! Excellent to hear that you got it working! :)
Very helpful. Worked perfectly to get the Java plugin running on Google Chrome on Fedora 16. (Chrome looks in the Firefox plugins dir automatically.) Thanks!
I’m using Fedora 16 and trying to install the 32-bit JRE and 32-bit FireFox. I have a 64-bit machine. I need 32-bit Firefox/JRE, because I need to use a SSL VPN web app that only supports 32-bit.
I’ve got 32-bit firefox installed with no problems, and I followed your directions in installting 32-bit JRE (on my 64-bit machine). Everything seems to work – I see the plugins in firefox; however, when I run the java test at java.com, it doesn’t work. Any ideas what I may be doing wrong? Any way for me to diagnose this?
Thanks! Great info, by the way!
Hi Tom,
How do you installed 32-bit Firefox?
I added the repos for fedora 32-bit and was able to ‘yum install’ it.
Hi again Tom,
I tried this same style 32-bit Firefox & Java setup on 64-bit Fedora, but I have exactly same problem. Firefox shows Java plugin, but it won’t work. I also tested 32-bit Google Chrome and I can’t get 32-bit Java browser plugin work on 64-bit system with 32-bit browser.
Thanks for the instructions. However, I made a typo and can’t find the waqy to undo it. while typing the following command, I wrote /usr/lin/ –etc– instead of lib. Now, everytime I invoke java, an error message appears because there is no /usr/lin path… Tried unlink but didn’t work.
alternatives –install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jre1.6.0_31/lib/i386/libnpjp2.so 20000
The solution is probably quite easy, but can’t find the way around it:
Thanks.
Hi Vicente,
Try following to remove it:
And then install it again…please let me know do you get it working?