Tuesday, July 5, 2011

Relacing OpenJDK with Oracle/Sun Java SDK as default java

According to some sources, Sun/Oracle JDK or JRE is slightly faster than OpenJDK.  To install the SunJDK without removing the OpenJDK is as follow:

  1. Download the SDK from here
  2. Install the SDK.  For example: sudo rpm -Uvih <sdk rpmfile> or sudo sh ./<sdk bin file>
  3. Once it is installed, copy-paste the following script and execute it

#!/bin/sh

for FP in /usr/java/default/bin/* ; do
    NAME=${FP##*/}
    echo installing $NAME
    sudo alternatives --install /usr/bin/${NAME} ${NAME} /usr/java/default/bin/${NAME} 20000
    alternatives --display "${NAME}" | grep "${NAME}"
done

1 comment:

  1. UPDATE-ALTERNATIVES(8) UPDATE-ALTERNATIVES(8)

    NAME
    alternatives - maintain symbolic links determining default commands

    SYNOPSIS
    alternatives [options] --install link name path priority [--slave link
    name path]... [--initscript service]

    alternatives [options] --remove name path

    alternatives [options] --set name path

    alternatives [options] --auto name

    alternatives [options] --display name

    alternatives [options] --config name

    DESCRIPTION
    alternatives creates, removes, maintains and displays information about
    the symbolic links comprising the alternatives system.

    ReplyDelete