Oracle Linux uses RPM (Red Hat Package Manager). If you want to install latest Java platform, you can download Java RPM packages from:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Oracle releases Java RPM wrapped in a self-extracting binary file. So instead of using rpm tool, you just change the mode of file, and make it executable and then run it:

Is it done? Let’s check it:

As you see, although we installed the latest Java, we still use the old one. Because of the incompatibilities between Java versions, when you install/update Java, it does not overwrite the previous versions. Instead, all installed Java versions are available to use.

At this point, “alternatives” system takes into action. The alternatives system is a reimplementation of the Debian alternatives system. It maintains symbolic links determining default commands.

Our java is installed under /usr/java/jdk1.6.0_26 (so the path of java binary is /usr/java/jdk1.6.0_26/bin/java). I’ll add this as the default for Java:

Here are the arguments:

–install tells that we’ll add a new alternative
/usr/bin/java is the default path for Java
java is the name of the software
/usr/java/jdk1.6.0_26/bin/java is the path of latest java we installed
16026 is the priority, I recommend you to give the exact version number so when you install a newer version and enter its version as priority, it’ll be selected as the default one (as long as mode is auto).

Let’s the alternatives of Java:

Let’s check the version of java:

You can also change the alternative of Java manually:

Type the number of the alernative you want to use and hit enter key.

14 Responses to “How to Install/Update Java (JDK) on Oracle Linux”

  1. Patricia says:

    Thanx from Spain!!!
    Your post has saved me.

  2. That worked a treat, thank you.

  3. Hi,
    I am running Oracle 11g R2.0.3 on a RedHat 5.8 server. The system java /usr/bin/java is the latest RedHat release of 1.6.
    There is another version of java located in $ORACLE_HOME/jdk/bin which is version 1.5.0_30. How do I update this to the latest?
    Thank you,
    Kerry

    • Gokhan Atil says:

      Hi Kerry, as I see it’s the JDK which is used only by Oracle Database management applications. I don’t see any reason to update it, and I recommend you to not to update it.

  4. You’re a life saver, thanks a lot :)

  5. ibtissam says:

    Hi ! I try to download JDK using this command :
    wget http://edelivery.oracle.com/otn-pub/…linux-i586.rpm

    But i get this answer :

    –2013-03-14 15:50:30– http://edelivery.oracle.com/otn-pub/…linux-i586.rpm
    Connecting to 138.21.89.192:3128… connected.
    Proxy request sent, awaiting response… 302 Found
    Location: https://edelivery.oracle.com/otn-pub…linux-i586.rpm [following]
    –2013-03-14 15:50:30– https://edelivery.oracle.com/otn-pub…linux-i586.rpm
    Resolving edelivery.oracle.com… failed: Name or service not known.
    wget: unable to resolve host address `edelivery.oracle.com’

    wget http://www.google.for work .

    Can You help me please?

    • Gokhan Atil says:

      It looks like a DNS problem. You may try to download it on your PC and then transfer the RPM file to the server.

      • ibtissam says:

        it was a problem of certificate on the oracle website ( you have to accept the conditions of the certificate before starting the download ). THank you for your answer, i sent my file using FTP .

  6. awreneau says:

    Great doc, helped me clear a hurdle. Shared it w/ my team. Many thanks.

  7. üstadım ben nokia asha için uygulama yazmak istiyorum fakat asha sdk sını yüklememe rağmen jdk 7 update 21 ve 17 yi yüklememi istedi. ardından bunlarıda yükledim fakat hala hata devam ediyor. rica etsem nedenini açıklayabilir misiniz?
    (ingilizcem pek yok ).

Leave a Reply

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 class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">