Java

Installing the Default JRE/JDK

The easiest option for installing Java is using the version packaged with Ubuntu. Specifically, this will install OpenJDK 8, the latest and recommended version.

apt update

sudo apt-get update

install JRE(Java Runtime Environment)

sudo apt-get install default-jre

Install JDK(Java Development Kit)

sudo apt-get install default-jdk

The JDK does contain the JRE.

Installing the Oracle JDK

If you want to install the Orcale JDK, which is the offical version distributed by Oracle.

Update your package repository

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

Oracle JDK 8

sudo apt-get install oracle-java8-installer

Oracle JDK 9

sudo apt-get install oracle-java9-installer

Managing Java

There can be multiple Java installations on one server. You can configure which version is the default for use in the command line by using update-alternatives, which manages which symbolic links are used for different commands.

sudo update-alternatives --config java

You can now choose the number to use as a default.

Setting the JAVA_HOME Environment Variable

.bash_profile or .profile에 아래의 변수를 추가한다.

JAVA_HOME='/usr/bin/java

References

How To Install Java with Apt-Get on Ubuntu 16.04

results matching ""

    No results matching ""