Install Sun/Oracle Java JDK/JRE 7u21 on Fedora 18/17, CentOS/RHEL 6.4/5.9

This is guide, howto Install Sun/Oracle Java JDK and JRE 7 update 21 (7u21) on Fedora 18/17/16/15/14/13/12, CentOS 6.4/6.3/6.2/6.1/6/5.9, Red Hat (RHEL) 6.4/6.3/6.2/6.1/6/5.9.

If you’re looking instruction for Sun/Oracle Java JDK/JRE version 6 installation on Fedora 18/17, CentOS/Red Hat (RHEL) 6.4/5.9, 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
    • 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 7u21 on Fedora 18/17/16/15/14/13/12, CentOS 6.4/6.3/6.2/6.1/6/5.9, Red Hat (RHEL) 6.4/6.3/6.2/6.1/6/5.9

1. Download Sun/Oracle Java JDK/JRE 7u21 32-bit/64-bit RPM packages

Download Sun/Oracle Java 7u21 from here http://www.oracle.com/technetwork/java/javase/downloads/index.html. Select rpm package (jdk-7u21-linux-i586.rpm, jdk-7u21-linux-x64.rpm, jre-7u21-linux-i586.rpm or jre-7u21-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-7u21-linux-i586.rpm
 
## JDK 64-bit ##
rpm -Uvh /path/to/binary/jdk-7u21-linux-x64.rpm
 
## JRE 32-bit ##
rpm -Uvh /path/to/binary/jre-7u21-linux-i586.rpm
 
## JRE 64-bit ##
rpm -Uvh /path/to/binary/jre-7u21-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_21)

## java ##
alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_21/jre/bin/java 20000
## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.7.0_21/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_21/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_21/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_21/bin/javac 20000
alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0_21/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_21)

## java ##
alternatives --install /usr/bin/java java /usr/java/jre1.7.0_21/bin/java 20000
 
## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/jre1.7.0_21/bin/javaws 20000
 
## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jre1.7.0_21/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_21/lib/amd64/libnpjp2.so 20000

5. Check current java, javac, javaws and libjavaplugin.so versions

java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-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_21

Note: Check libjavaplugin.so with restarting Mozilla Firefox and writing about:plugins on address bar.

Java 7 console output on Fedora 18:

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_21/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_21/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_21/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_21/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_21/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_21)

## export JAVA_HOME JDK ##
export JAVA_HOME="/usr/java/jdk1.7.0_21"
 
## export JAVA_HOME JRE ##
export JAVA_HOME="/usr/java/jre1.7.0_21"
Follow If Not True Then False Updates!

178 Comments

  1. Thanks for publishing this java installation guide.

  2. 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

  3. Err. edit from previous post it should be /usr/java/latest *

  4. 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 agree to the above license terms? [yes or no]
    yes
    Unpacking...
    Checksumming...
    Extracting...
    UnZipSFX 5.52 of 28 February 2005, by Info-ZIP (http://www.info-zip.org).
      inflating: jdk-7-ea-linux-i586.rpm  
    Failed to extract the files.  Please refer to the Troubleshooting section of
    the Installation Instructions on the download page for more information.

    Do you get it to work normally?

  5. 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?

  6. good tutorial man thx

  7. Thanks for sharing.

  8. Guia super chingona !!

    Thanks !! This Java Guide is great

  9. 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…

  10. 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… :)

  11. 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… :)

  12. 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.

  13. thank you, thank you, thank you

  14. 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… :)

  15. 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:

      alternatives --config java
      alternatives --config javaws
       
      ## 32 Bit ##
      alternatives --config libjavaplugin.so
       
      ## 64-bit ##
      alternatives --config libjavaplugin.so.x86_64
       
      ## JDK ##
      alternatives --config javac

      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:

      /usr/java/jdk1.7.0_01/jre/bin/java -jar some_java_application.jar
  16. 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

      ## java ##
      alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 20000
      ## javaws (32-bit only) ##
      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

      JRE

      ## java ##
      alternatives --install /usr/bin/java java /usr/java/latest/bin/java 20000
       
      ## javaws (32-bit only) ##
      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

      You could easily check where your default and latest point with following command:

      ls -la /usr/java
      ...
      lrwxrwxrwx.  1 root root   16 Oct 15 13:59 default -> /usr/java/latest
      drwxr-xr-x.  3 root root 4096 Oct 25 23:44 jdk1.7.0
      drwxr-xr-x. 10 root root 4096 Oct 25 23:44 jdk1.7.0_01
      lrwxrwxrwx.  1 root root   21 Oct 25 23:44 latest -> /usr/java/jdk1.7.0_01

      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! :)

  17. 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:

      ls -la /usr/java/jdk1.7.0_01/jre/bin/
      • i also have the same problem. it seems javaws is not working. :(

  18. 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?

  19. 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?

  20. 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:

        ls -la /usr/bin/java
         
        ls -la /etc/alternatives/java
         
        ls -la /usr/java/latest/jre/bin/java
         
        ls -la /usr/java/latest/bin/java
         
        ls -la /usr/java/
         
        env |grep -i -e java -e path
        • 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!

  21. errata “Select rpm.bin” should be “Select rpm”

    • Thanks Glenn! I fixed it, yes it should be just “rpm” :)

  22. 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.

  23. Many thanks. This worked perfectly. Fantastic!

    I appreciate your work.

  24. 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:

      alternatives --config javaws
  25. hi,
    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? :)

  26. Oh yeah it’s very simple to install java on Linux !!!

    • Hi under2sea,

      I agree, very simple setup… :)

  27. Thanks! Great post & nice site for red eyed linux users.

  28. 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?

  29. 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:

      uname -a
       
      lsb_release -a
      • Thanks Jr, the command was
        alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so \ libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000

        If I remove the “/”
        alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000
        The 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 20000
        Will 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/Linux
          lsb_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:

            ls -la /usr/lib64/mozilla/plugins/libjavaplugin.so
             
            ls -la /etc/alternatives/libjavaplugin.so.x86_64
             
            ls -la /usr/java/
             
            ls -la /usr/java/latest/lib/amd64/libnpjp2.so
             
            ls -la /usr/java/latest/jre/lib/amd64/libnpjp2.so
  30. 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_64
    ls -la /etc/alternatives/libjavaplugin.so.x86_64
    /etc/alternatives/libjavaplugin.so.x86_64 -> /usr/java/latest/jre/amd64/libnpjp2.so
    Obviously, 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.so
    ls -la /usr/java/latest/jre/lib/amd64/libnpjp2.so
    ls: cannot access /usr/java/latest/jre/lib/amd64/libnpjp2.so: No such file or directory
    ls -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.so

    • Your 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:

      alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jre1.6.0_30/lib/amd64/libnpjp2.so 20000
       
      ## OR ##
      alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000

      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:

          alternatives --remove libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so

          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.

  31. Steps provided was just what was needed for RHEL newbie learning Linux in more detail. Thanks much and keep up the great work!

  32. 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! :)

  33. Thanks for the instructions. Worked like a charm!!!

  34. Thanks for this tutorial, I’m new user in Linux and finally found one that worked. :)

  35. Thanks for this.

  36. Thank You so much it just worked perfectly

  37. Perfect!
    Great tutorial.

    Thanks.

  38. Glad I found your guide (I plan to try it soon)… excellent attention to detail!

    Question 1: I plan to install JDK 7u5, so will guide work (assuming I replace ’7u4′ with ’7u5′ in the relevant commands)?

    Question 2: Do I need to perform the steps described in BOTH “Use Java JDK latest version (/usr/java/latest)” *AND* “Use Java JDK absolute version (/usr/java/jdk1.7.0_04)”?

    Question 3: In reference to “Use Java JDK absolute version (/usr/java/jdk1.7.0_04)”, will the “jdk1.7.0_04″ number change if I’m installing JDK 7u5?

    Thanks, JR!

    • Hi r0b0ty,

      I just updated this guide so answer for your first and third question found from guide and just select latest or absolute method. I strongly recommend latest method, so then later updates are very much easier… :)

      • It has been going perfectly well… I’m on Step 6. “Swap between OpenJDK and Sun/Oracle Java JDK/JRE 6 and 7 versions” but I don’t see the “/usr/java/jdk1.7.0_05/jre/bin/java” selection… only this:

        “There are 2 programs which provide ‘java’.

        Selection Command
        ———————————————–
        1 /usr/lib/jvm/jre-1.7.0-openjdk/bin/java
        *+ 2 /usr/java/latest/jre/bin/java”

        I installed jdk-7u5-linux-i586.rpm, however (and yes, I know it includes JRE)… Is this a problem?

        I’m sure it has to do with Step 4a, where I chose to use the “latest” method. Does the …/latest/… directory really point to “/usr/java/jdk1.7.0_05/” directory, or something?

        • It is exactly correct way to use /usr/java/latest/jre/bin/java and you should not see that /usr/java/jdk1.7.0_05/ directory, when you use latest. :) Latest is just link to always latest Java dirctory.

          You can check your java version, with following command:

          java -version

          Should be:
          java version "1.7.0_05"
          ...

          • That’s what I suspected. So I can say that your guide worked perfectly for me. Thank you very much for your effort!

            • Nice to hear! You are very welcome!

  39. Hi, I need to run a program that need JVM, I folowed your instructios but when I run my program it show me the same error.
    Error occurred during initialization of VM
    Could not reserve enough space for object heap
    Could not create the Java virtual machine.

    My program is for my theses so I need help for install JVM, please help me.
    My program is Apollo: http://apollo.berkeleybop.org/current/index.html

    • Ah, I used the lastedt version and doesn’t work and then I used the absolute version and doesn’t work, I don’t have javaws and javac, but I suppouse that I don’t need those for nunning my program.

  40. Hi,

    Thank you for your kind effort, but I’m afraid, your instrutions are misleading already. When I install strictly according to the ORACLE’s instructions:
    ———————–
    .
    .
    .
    Linux

    JDK 7 Installation on Linux Platforms – both 32-bit and 64-bit, including RPM
    JRE 7 Installation on Linux Platforms – both 32-bit and 64-bit, including RPM

    In order to run Java applets within a browser, you must install the JRE plugin manually. Instructions for that process are available here:

    Manual Plugin Installation for Linux
    .
    .
    .
    ———————–
    evrything works fine, no need for different instructions. Apart from that, there seems to be a mistake in your instruction:
    it is
    /usr/java/latest/…
    rather than
    /usr/java/latest/jre/…

    also

    cd /usr/lib64/mozilla/plugins
    ln -s /usr/java/latest/lib/amd64/libnpjp2.so .
    rather than
    ln -s /usr/java/latest/lib/amd64/libnpjp2.so libjavaplugin.so

    • Hi Anatoly,

      Thanks for this info, I will recheck this guide soon and fix this guide if there is something wrong… :)

      Did you noticed that the JRE part uses /usr/java/latest/ and JDK part uses /usr/java/latest/jre/?

      • Hi again Anatoly,

        This guide works normally for me, and Java plugin works normally with clean installed system on Firefox and Google Chrome using alternatives command.

        And also paths /usr/java/latest/ for JRE and /usr/java/latest/jre/ for JDK works just right?

        • Hi JR,

          Thank you for the re-check. You must be right.

          Cheers

  41. updated version, but my google chrome is still pointing my java needs to be updated, somebody is having the same problem?

    • Hi jean,

      Could you post output of following command:

      ## 32-bit Java ##
      alternatives --config libjavaplugin.so
       
      ## 64-bit Java ##
      alternatives --config libjavaplugin.so.x86_64

      Did you remember start all browser instances after Java upgrade?

      • Yes i rebooted system, after upgrade Java.
        alternatives –config libjavaplugin.so.x86_64
        Há 3 programas que oferecem “libjavaplugin.so.x86_64″.
        Seleção Comando
        ———————————————–
        1 /usr/lib64/IcedTeaPlugin.so
        2 /usr/lib/jvm/jre-1.7.0u04-sun-x64/lib/amd64/libnpjp2.so
        *+ 3 /usr/java/latest/lib/amd64/libnpjp2.so

  42. Yes i rebooted system, after upgrade Java.

    alternatives –config libjavaplugin.so.x86_64

    Há 3 programas que oferecem “libjavaplugin.so.x86_64″.

    Seleção Comando
    ———————————————–
    1 /usr/lib64/IcedTeaPlugin.so
    2 /usr/lib/jvm/jre-1.7.0u04-sun-x64/lib/amd64/libnpjp2.so
    *+ 3 /usr/java/latest/lib/amd64/libnpjp2.so

    • Thanks, could you also post output of following command:

      ls -la /usr/java
      • ls -la /usr/java
        total 12
        drwxr-xr-x. 3 root root 4096 Ago 22 23:42 .
        drwxr-xr-x. 14 root root 4096 Ago 10 00:12 ..
        lrwxrwxrwx. 1 root root 16 Ago 22 23:38 default -> /usr/java/latest
        drwxr-xr-x. 6 root root 4096 Ago 22 23:38 jre1.7.0_06
        lrwxrwxrwx. 1 root root 21 Ago 22 23:38 latest -> /usr/java/jre1.7.0_06

        • Everything looks good so far.

          Could you tell more specific what kind of error you get on Google Chrome, do get this error just some site(s) or always when you use Google Chrome?

          Which Java plugin you see, if you go to chrome://plugins/ ?

          • When I enter the page chrome :/ / plugins shows that you need a security update, but I already have the latest update of java, I still do not understand why asking an update.
            I take a printscreen of the screen.

            http://postimage.org/image/gr3ogu8tx/

            • What version of Google Chrome you are using?

              Go to: chrome://version

              • Google Chrome 21.0.1180.81 (Versão oficial 151980)
                SO Linux
                WebKit 537.1 (@125733)
                JavaScript V8 3.11.10.18
                Flash 11.3.31.230

                • Hi jean,

                  Your browser and Java plugin looks good.

                  That’s why I searched more information about this problem and I found out that this is Google Chrome bug, check this discussion and bug report.

                  Currently you can only wait next Google Chrome version and hopefully this problem is fixed then.

                  You can try following as a temporary fix to the problem. Start Google Chrome with following parameter and then you should get rid of this message:

                  google-chrome --allow-outdated-plugins
                  • ok, i will use the parameters while the version is not corrected.
                    Thank you for a search and discover the bug.

                    • You are welcome!

  43. Hi JR,

    i’m new to linux, i don’t know how to instal Java JDK,
    when i follow your instruction number 3, there is some error :

    rpm -Uvh /path/to/binary/jdk-7u7-linux-x64.rpm
    error: open of /path/to/binary/jdk-7u7-linux-x64.rpm failed: No such file or directory

    and then i try to follow the oracle java se documentation installation guide, and there is also have some error :

    the rpm -ivh jdk-7u7-linux-x64.rpm
    Preparing… ########################################### [100%]
    1:jdk ########################################### [100%]
    Unpacking JAR files…
    rt.jar…
    Error: Could not open input file: /usr/java/jdk1.7.0_07/jre/lib/rt.pack
    jsse.jar…
    Error: Could not open input file: /usr/java/jdk1.7.0_07/jre/lib/jsse.pack
    charsets.jar…
    Error: Could not open input file: /usr/java/jdk1.7.0_07/jre/lib/charsets.pack
    tools.jar…
    Error: Could not open input file: /usr/java/jdk1.7.0_07/lib/tools.pack
    localedata.jar…
    Error: Could not open input file: /usr/java/jdk1.7.0_07/jre/lib/ext/localedata.pack

    please help me to resolved this error. thank you

    • Hi afr,

      On my guide /path/to/binary/ means path (directory) where you downloaded rpm package. Real world path (dir) could be something like /home/afr/Downloads, if your username is afr.

      Did you run this rpm command as root user?

      • Thank you very much JR, your guide worked for me.

        • You are welcome. Excellent to hear that you got it working!

          And welcome to Linux world, if you have some other Linux questions, feel free to ask :)

    • Hi RFederer,

      java.com site is aimed primarily to ordinary Java users who just want/need Java JRE (Java Runtime Environment) version, like browser plug-in and the ability to run Java applications. And oracle.com site is aimed primarily Java developers who develop Java programs, compile Java code and of course run Java programs. I use Oracle site here, because you can download both versions JDK (Java Development Kit) and JRE (Java Runtime Environment) from there.

      Btw. Java is Oracle product and java.com is Oracle’s site, if you look just JRE version then you can use of course java.com.

      If you download JRE package from java.com and oracle.com and compare md5sum’s, you see that those are exactly same, because it’s just same file. :)

      ## 32-bit JRE from java.com ##
      9c45f8adf9f235105c74347e0d6b2b2e  jre-7u7-linux-i586.rpm
       
      ## 32-bit JRE from orcle.com ##
      9c45f8adf9f235105c74347e0d6b2b2e  jre-7u7-linux-i586.rpm

      Btw. I link to http://www.oracle.com/technetwork/java/javase/downloads/index.html not directly to JDK download page (http://www.oracle.com/technetwork/java/javase/downloads/jdk7u7-downloads-1836413.html. :)

  44. Is the x86_64 rpm package of the latest java corrupt? I can’t extract it..

    • Hi Sigg3,

      What error messages you get when you try extract it? Did you tried extract JDK or JRE?

      • The JRE. I get this:
        # rpm -Uvh "jre-7u7-linux-x64(2).rpm"
        Preparing... ########################################### [100%]
        1:jre ########################################### [100%]
        Unpacking JAR files...
        rt.jar...
        Error: Could not open input file: /usr/java/jre1.7.0_07/lib/rt.pack
        jsse.jar...
        Error: Could not open input file: /usr/java/jre1.7.0_07/lib/jsse.pack
        charsets.jar...
        Error: Could not open input file: /usr/java/jre1.7.0_07/lib/charsets.pack
        localedata.jar...
        Error: Could not open input file: /usr/java/jre1.7.0_07/lib/ext/localedata.pack

        • Hi Sigg3,

          I see what you mean, actually you can ignore those .pack file errors, all jar packages are unpacked successfully (without errors). .pack used by Java Web Start clients to retrieve and unpack JAR files for Java programs. So these errors doesn’t affect the JRE / JDK functionality when you install it using RPM package.

          • You are right, I am now running the latest jre from oracle! Thanks!

  45. Why the ’20000′ parameter is needed in the alternate command? e.g. alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 20000

    Is it better to use the latest version or the absolute one when creating the symlinks?

    • Hi Simo,

      20000 parameter is priority and it’s mandatory.

      usage: alternatives --install <link> <name> <path> <priority>
                          [--initscript <service>]
                          [--slave <link> <name> <path>]*
             alternatives --remove <name> <path>
             alternatives --auto <name>
             alternatives --config <name>
             alternatives --display <name>
             alternatives --set <name> <path>
       
      ...
       
      Each alternative has a priority associated with it.  When a link  group
      is  in  automatic  mode,  the alternatives pointed to by members of the
      group will be those which have the highest priority.

      Latest version is better, if you don’t have any particular reason to run just exact version of Java.

  46. I am getting this error in the second step!


    error: open of /path/to/binary/jdk-7u7-linux-x64.rpm failed: No such file or directory

    Why am I having problems installing everything on Fedora? :(

    • This is just example path, you have to use right path, where you downloaded jdk-7u7-linux-x64.rpm file. Normally it’s under your your user Downloads directory if you do not changed download location.

  47. How can I remove openjdk after that? Issuing “yum remove openjdk” wants to remove openjdk with tons of other useful softwares

    • Hi Nirjhor,

      Do you need free disk space or why you want to remove OpenJDK?

  48. Could you please give me some tip – why do I get that errors?

    Unpacking JAR files…
    rt.jar…
    Error: Could not open input file: /usr/java/jre1.7.0_09/lib/rt.pack
    jsse.jar…
    Error: Could not open input file: /usr/java/jre1.7.0_09/lib/jsse.pack
    charsets.jar…
    Error: Could not open input file: /usr/java/jre1.7.0_09/lib/charsets.pack
    localedata.jar…
    Error: Could not open input file: /usr/java/jre1.7.0_09/lib/ext/localedata.pack
    plugin.jar…
    Error: Could not open input file: /usr/java/jre1.7.0_09/lib/plugin.pack
    javaws.jar…
    Error: Could not open input file: /usr/java/jre1.7.0_09/lib/javaws.pack
    deploy.jar…
    Error: Could not open input file: /usr/java/jre1.7.0_09/lib/deploy.pack

    • Hi Gizmo,

      you can ignore those .pack file errors, all jar packages are unpacked successfully (without errors). .pack used by Java Web Start clients to retrieve and unpack JAR files for Java programs. So these errors doesn’t affect the JRE / JDK functionality when you install it using RPM package.

      • Thank you.

  49. Hi,

    Javaws not found on my system:

    # javaws
    bash: javaws: command not found…

    Here my outputs from the ls commands:

    #ls -la /usr/bin/java
    lrwxrwxrwx. 1 root root 22 Nov 28 20:53 /usr/bin/java -> /etc/alternatives/java

    #ls -la /etc/alternatives/java
    lrwxrwxrwx. 1 root root 34 Nov 28 20:53 /etc/alternatives/java -> /usr/java/jdk1.7.0_09/jre/bin/java

    # ls -la /usr/java/latest/jre/bin/java
    -rwxr-xr-x. 1 root root 7750 Set 25 00:43 /usr/java/latest/jre/bin/java

    #ls -la /usr/java/latest/bin/java
    -rwxr-xr-x. 1 root root 7750 Set 25 00:43 /usr/java/latest/bin/java

    #ls -la /usr/java/
    total 16
    drwxr-xr-x. 4 root root 4096 Nov 28 21:12 .
    drwxr-xr-x. 14 root root 4096 Set 25 00:39 ..
    lrwxrwxrwx. 1 root root 16 Nov 28 19:49 default -> /usr/java/latest
    drwxr-xr-x. 10 root root 4096 Nov 28 19:49 jdk1.7.0_09
    drwxr-xr-x. 6 root root 4096 Nov 28 21:12 jre1.7.0_09
    lrwxrwxrwx. 1 root root 21 Nov 28 19:49 latest -> /usr/java/jdk1.7.0_09

    # env |grep -i -e java -e path
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
    PWD=/usr/java/jdk1.7.0_09/jre/bin
    JAVA_HOME=/usr/java/jre1.7.0._09

    Tks in advance

    • Hi crossfire,

      Run following as root:

      updatedb

      Then post output of following command:

      locate javaws
      • [root@P073|\|714L_7|-|R347 /]# locate javaws
        /home/user/.kde/share/apps/RecentDocuments/javaws.itweb.desktop
        /home/user/.local/share/applications/javaws.itweb.desktop
        /usr/bin/javaws
        /usr/bin/javaws.itweb
        /usr/java/jdk1.7.0_10/bin/javaws
        /usr/java/jdk1.7.0_10/jre/bin/javaws
        /usr/java/jdk1.7.0_10/jre/lib/javaws.jar
        /usr/java/jdk1.7.0_10/jre/lib/desktop/applications/sun-javaws.desktop
        /usr/java/jdk1.7.0_10/jre/lib/desktop/icons/HighContrast/16×16/apps/sun-javaws.png
        /usr/java/jdk1.7.0_10/jre/lib/desktop/icons/HighContrast/48×48/apps/sun-javaws.png
        /usr/java/jdk1.7.0_10/jre/lib/desktop/icons/HighContrastInverse/16×16/apps/sun-javaws.png
        /usr/java/jdk1.7.0_10/jre/lib/desktop/icons/HighContrastInverse/48×48/apps/sun-javaws.png
        /usr/java/jdk1.7.0_10/jre/lib/desktop/icons/LowContrast/16×16/apps/sun-javaws.png
        /usr/java/jdk1.7.0_10/jre/lib/desktop/icons/LowContrast/48×48/apps/sun-javaws.png
        /usr/java/jdk1.7.0_10/jre/lib/desktop/icons/hicolor/16×16/apps/sun-javaws.png
        /usr/java/jdk1.7.0_10/jre/lib/desktop/icons/hicolor/48×48/apps/sun-javaws.png
        /usr/java/jdk1.7.0_10/jre/lib/security/javaws.policy
        /usr/java/jdk1.7.0_10/man/ja_JP.UTF-8/man1/javaws.1
        /usr/java/jdk1.7.0_10/man/man1/javaws.1
        /usr/java/jre1.7.0_10/bin/javaws
        /usr/java/jre1.7.0_10/lib/javaws.jar
        /usr/java/jre1.7.0_10/lib/desktop/applications/sun-javaws.desktop
        /usr/java/jre1.7.0_10/lib/desktop/icons/HighContrast/16×16/apps/sun-javaws.png
        /usr/java/jre1.7.0_10/lib/desktop/icons/HighContrast/48×48/apps/sun-javaws.png
        /usr/java/jre1.7.0_10/lib/desktop/icons/HighContrastInverse/16×16/apps/sun-javaws.png
        /usr/java/jre1.7.0_10/lib/desktop/icons/HighContrastInverse/48×48/apps/sun-javaws.png
        /usr/java/jre1.7.0_10/lib/desktop/icons/LowContrast/16×16/apps/sun-javaws.png
        /usr/java/jre1.7.0_10/lib/desktop/icons/LowContrast/48×48/apps/sun-javaws.png
        /usr/java/jre1.7.0_10/lib/desktop/icons/hicolor/16×16/apps/sun-javaws.png
        /usr/java/jre1.7.0_10/lib/desktop/icons/hicolor/48×48/apps/sun-javaws.png
        /usr/java/jre1.7.0_10/lib/security/javaws.policy
        /usr/java/jre1.7.0_10/man/ja_JP.UTF-8/man1/javaws.1
        /usr/java/jre1.7.0_10/man/man1/javaws.1
        /usr/share/applications/javaws.desktop
        /usr/share/bash-completion/completions/javaws
        /usr/share/man/man1/javaws-itweb.1.gz
        /usr/share/pixmaps/javaws.png
        /var/lib/alternatives/javaws

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackbacks/Pingbacks

  1. 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, ...
  2. 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: ...
  3. Android SDK r12 and Eclipse ADT on Fedora 15/14, CentOS/Red Hat (RHEL) 6 - [...] 1.1 Install Sun/Oracle Java 7 JDK/JRE [...]
  4. 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 ...
  5. 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 ...
  6. 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... [...]
  7. 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/ -- ...
  8. 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 ...