[last updated: 2019-05-23]
go to: Java
go to: Java: download & install on Linux - mostly unsuccessful learning
-----
- As always before making changes:
$ sudo apt-get update
$ sudo apt-get dist-upgrade
- Open command terminal and move to /usr directory
$ sudo mkdir java
$ cd java
$ sudo apt-get install openjdk-8-jdk
- $ java -version
should report something similar to:
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.16.04.1-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)
- Edit profile:
$ cd /etc
$ sudo nano profile
add the following lines to the very end of the file:
JAVA_HOME=/usr/java/openjdk-8-jdk
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
- Then: ctrl-o to write/save, then press enter
ctrl-x to exit nano
- $ . /etc/profile to reload profile
- However: This changes the prompt color from green to white.
And while the PATH change is active in this command window, it is NOT valid in a different or new window.
You must reboot for the change to work in all cases.
- Test Java with 'Hello World'
.
.
.
eof