How to upgrade Java on a Linux Server?

Steps to upgrade Java on a Linux Server.

  1. Go to the “/usr/local/src/” directory.

    cd /usr/local/src/

  2. Download the latest package[rpm]

    from the following page using “wget”.
    http://www.java.com/en/download/manual.jsp#lin

  3. Install the rpm.

    [root@vm src]# rpm -Uvh jre-7u7-linux-x64.rpm
    Preparing... ########################################### [100%]
    package jre-1.7.0_07-fcs.x86_64 is installed
    [root@vm src]#

  4. Update the “symbolic links”

    using the following commands.
    [root@vm src]# update-alternatives --install /usr/bin/java java /usr/java/jre1.7.0_07/bin/java 3
    [root@vm src]# alternatives --config java

    There are 3 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/jre1.7.0_07/bin/java

    Enter to keep the current selection[+], or type selection number: 3
    [root@vm src]#

  5. Verify the Java version

    [root@vm src]# java -version
    java version "1.7.0_07"
    Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
    Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

banner

wizard has written 12 articles

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> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>