LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

How to Rapidly Install Java, OpenJDK & Oracle JDK on your VPS

lowendtutorial

Perhaps you’re using a Low End Box to host a game or some type of application that requires the Java Runtime Environment. Perhaps you’d like to use your VPS as a dev environment for your Java app?

While the installation of Java on a Linux VPS is quite painless, it can be difficult to demystify all of the different flavors of Java available on the market.

For example, do you need the JRE, JDK, the OpenJDK or the Oracle JDK?

The solution to that question will likely be answered by what you are trying to accomplish your virtual private server. Let’s quickly review these terms so that you can ensure that you are installing correct architecture for your workloads:

  • JRE – The Java Runtime Environment
  • JDK – The Java Developers Kit
  • OpenJDK – Open Source Implementation of the Java Platform (Backed by Red Hat)
  • Oracle JDK – Oracle’s Take on the Java Environment (More Stable)

How to Install Java on your Ubuntu VPS

Before installing Java on your VPS, make sure you update the package index.

sudo apt-get update

Next: Check to See if you have any Previous Versions of Java Installed

To perform the preflight check of your Java install, see if you already have any versions installed. You can find this by typing:

java –version

How to Install the Different Flavors of Java

Default JRE

sudo apt-get install default-jre

Standard JDK

sudo apt-get install default-jdk

OpenJDK’s JDK

sudo apt-get install openjdk-8-jdk

OpenJDK’s JRE

sudo apt-get install openjdk-8-jre

Tip: If you need an older version, simply toggle the “8” to “7” and try the command.

Oracle JDK Installation

To install Oracle JDK from the command line interface, use the following commands:

sudo apt-add-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java8-installer

The Oracle Java 8 Installer includes both the JDK and JRE for your VPS.

Tip: Ensure that your JAVA_HOME variable is set to: /usr/lib/jvm/java-8-oracle

Each of these Java implementations have different uses. Corporate enterprises will rely more on the Oracle architecture while independent developers may resort to the OpenJDK approach.

Hobbyists and those looking to have some fun with their low end box may designate their Linux VPS server as gaming server. Others may use Java on a VPS to run a web based application.

Regardless of your motivations with Java, this quick tutorial should have you up and running with one of the world’s most versatile software development kits that is currently being used by those who host virtual private servers.

mpkossen

1 Comment

  1. Hector Fosado:

    Hello. We need to know the price of your most affordable VPS with cPanel which can host and use ORACLE data bases. Do you offer such an option?

    November 7, 2016 @ 1:47 am | Reply

Leave a Reply

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
  • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

Your email address will not be published. Required fields are marked *