Technology

Replacing OpenJDK with Oracle JDK on Ubuntu

Learn how to replace OpenJDK with Oracle JDK for enhanced performance on Ubuntu systems. Follow our step-by-step guide for downloading and installation.

Sangrak

On Ubuntu, while it is conveniently possible to install OpenJDK directly via apt-get, Oracle's JDK boasts greater performance advantages. First, visit the official website to download the JDK version that matches your system, and then upload it to your server. The commands below, with the version name filled in accordingly, will guide you through the installation process.

Installation Steps

$ tar zxvf jdk-7u7-linux-*.gz
$ mkdir -p /usr/lib/jvm/jdk1.7.0
$ mv jdk1.7.0_07/* /usr/lib/jvm/jdk1.7.0/

$ update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
$ update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
$ update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1

Confirming the Installation

$ java -version

By following these steps, you can enhance your system's performance by upgrading to Oracle JDK and gaining access to its optimized functionalities.

More on this topic