Download the JDK/JRE:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Extract the file "
jdk-8u111-linux-x64.tar.gz" in the folder you want to install Java:
/opt/jdk1.8.0_111
Change the folder permissions:
Setup the environment variables
JAVA_HOME and
PATH:
-
Open the file ".profile":
-
Append the following lines:
-
Reload the file ".profile":
-
Verify the environment variables:
Locate the default java program file:
Note that on macOS you might get an error similar to this one when you launch java commands:
"
jdk-13.0.1.jdk cannot be opened because the developer cannot be verified ..."
To fix this issue run the following command on the jdk package before extracting it: