Introduction
If you had the option to choose between a base model car or a fully loaded model, which one will you choose?
Both cars will take you from point A to point B, but with the fully loaded car you have additional features that can make rush hour a chill hour.
Well, that’s the same concept when we take a closer look at Java. There are two standard types of installations, JRE (Java Runtime Environment) and JDK (Java Development Kit). Like the base model car, JRE enables the ability to create Java Applications for different types of deployments using minimal core tools to accomplish the task. JDK is a fully loaded Development Kit that has everything that JRE has plus additional resources to create/secure Applications and Applets.
Prerequisites
You need a Ubuntu server that is configured with a static IP address. If you do not have a server already, why not spin up a robust and reliable Cloud Server in under 30 seconds.Installing Java on Ubuntu 16.04
Before we begin, let make sure that the server is fully updated with the following command:- sudo apt update
- java -version
Install Java Open JRE or JDK on Ubuntu 16.04
Once you have verified if Java is installed or not, choose the type of Java installation that you want with one the following:- sudo apt install default-jdk
- sudo apt install default-jre
- sudo apt install openjdk-7-jre
- sudo apt install openjdk-7-jdk
Install Java Oracle JRE or JDK on Ubuntu 16.04
Another alternative Java install is with Oracle JRE and JDK. However, we would need to install additional repositories for a proper installation.- sudo apt install python-software-properties
- sudo add-apt-repository ppa:webupd8team/java
- sudo apt update
- sudo apt install oracle-java6-installer
- sudo apt install oracle-java7-installer
- sudo apt install oracle-java8-installer
- sudo update-alternatives --config java
Once you have viewed your alternatives, choose the version that you want by selecting the assigned number, and then hit enter.
Setup JAVA_HOME on Ubuntu 16.04
Since many programs now days need a JAVA_HOME environment variable to work properly. We will need to find the appropriate path to make these changes. With the following command, you can view your installs and their path:- sudo update-alternatives --config java
- sudo nano /etc/profile
- export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.51-1.b16.el7_1.x86_64"
- source /etc/profile
- echo $JAVA_HOME








