How to install and configure latest Oracle JDK in Fedora

Most parts of this How-To have been taken from

  1. Check Java version
    $ java -version
    java version "1.7.0_05-icedtea"
    OpenJDK Runtime Environment (fedora-2.2.1.fc17.9-x86_64)
    OpenJDK 64-Bit Server VM (build 23.0-b21, mixed mode)
  2. Download latest JDK from Oracle website
  3. Install JDK
    Use the graphical RPM installer interface via your web browser or
    command line
    $ sudo rpm -Uvh /path/to/binary/jdk-<version>-linux-<architecture>.rpm
  4. Register and use Oracle JRE and JDK
    ## java ##
    $ sudo alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 20000
    ## javaws ##
    $ sudo alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 20000
    ## Java Browser (Mozilla) Plugin 32-bit ##
    $ sudo alternatives --install /usr/lib/mozilla/plugins/ /usr/java/latest/jre/lib/i386/ 20000
    ## Java Browser (Mozilla) Plugin 64-bit ##
    $ sudo alternatives --install /usr/lib64/mozilla/plugins/ /usr/java/latest/jre/lib/amd64/ 20000
    ## javac (from JDK package) ##
    $ sudo alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 20000
    $ sudo alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 20000
  5. Check Java version
    $ java -version
    java version "1.7.0_05"
    Java(TM) SE Runtime Environment (build 1.7.0_05-b06)
    Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
  6. Add JAVA_HOME environment variable
    Create and edit the file /etc/profile.d/
    $ sudo nano /etc/profile.d/
    # set Java JRE/JDK home
    export JAVA_HOME="/usr/java/latest"

    Save the file, log out and log back in
  7. To switch between installed Java versions type
    $ sudo alternatives --config java
    and select the desired version.

About h0nk3ym0nk3y

h0nk3ym0nk3y is one of the three LinuxM0nk3ys from Linux M0nk3ys @ WordPress Linux M0nk3ys @ YouTube Linux M0nk3ys @ Twitter

Posted on August 25, 2012, in Configure, Install and tagged , , , . Bookmark the permalink. 1 Comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: