Java installation

The Java Runtime Environment or JRE is the software required to run any application deployed on the Java Platform.

Java SDK consists from JRE and development tools such as the Java compiler, Javadoc, and debugger. This is more commonly known as the JDK.

There are most popular JDK implementations:

setup OpenJDK

Manual setup in brief:

  1. download archive with OpenJDK
  2. unzip archive
  3. set system variable JAVA_HOME to jdk
  4. add %JAVA_HOME%/bin to PATH variable
  5. configure you IDE

Below instruction how install OpenJDK on Ubuntu.

# check current java version
java -version

# update repository
apt-get update

# install repository
apt-get install openjdk-8-jdk

# set system variable to current jdk
export JAVA_HOME=path_to_java_home

# check version again
java -version

# It is possible has multiple installed jdk/jre
# check list of installed jdk/jre
update-alternatives --get-selections

# select current default jdk
update-alternatives --set java /usr/lib/jvm/jdk1.8.0_version/bin/java

# or 
update-alternatives --config java

On MacOS you can use homebrew:

brew install openjdk