$ java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
Step 3: Generate the default variables
$ sudo apt-get install oracle-java8-set-default
Version context
This procedure describes the software and the environment available at the time of its publication. The packages, interfaces, and repositories mentioned may have changed or disappeared; first check the system version and its support level.
cat /etc/os-release
uname -r
Work on a backup or a snapshot, note every modified file, and prepare for rollback. For a current workstation or server, prefer signed packages from officially supported repositories.