Java SE Development Kit 8u161 - setup with alternatives


- yum localinstall

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

```shell-session
# yum localinstall jdk-8u161-linux-x64.rpm 

Loaded plugins: langpacks, ulninfo
Examining jdk-8u161-linux-x64.rpm: 2000:jdk1.8-1.8.0_161-fcs.x86_64
Marking jdk-8u161-linux-x64.rpm as an update to 2000:jdk1.8-1.8.0_151-fcs.x86_64
Resolving Dependencies
--> Running transaction check
---> Package jdk1.8.x86_64 2000:1.8.0_151-fcs will be updated
---> Package jdk1.8.x86_64 2000:1.8.0_161-fcs will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================
 Package               Arch                  Version                           Repository                           Size
=========================================================================================================================
Updating:
 jdk1.8                x86_64                2000:1.8.0_161-fcs                /jdk-8u161-linux-x64                276 M

Transaction Summary
=========================================================================================================================
Upgrade  1 Package

Total size: 276 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : 2000:jdk1.8-1.8.0_161-fcs.x86_64                                                                      1/2 
Unpacking JAR files...
	tools.jar...
	plugin.jar...
	javaws.jar...
	deploy.jar...
	rt.jar...
	jsse.jar...
	charsets.jar...
	localedata.jar...
  Cleanup    : 2000:jdk1.8-1.8.0_151-fcs.x86_64                                                                      2/2 
  Verifying  : 2000:jdk1.8-1.8.0_161-fcs.x86_64                                                                      1/2 
  Verifying  : 2000:jdk1.8-1.8.0_151-fcs.x86_64                                                                      2/2 

Updated:
  jdk1.8.x86_64 2000:1.8.0_161-fcs                                                                                       

Complete!
```

- alternatives install

```shell-session

# alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 3
# alternatives --install /usr/bin/java java /usr/java/latest/bin/java 3
```

- update-alternatives

```shell-session
# update-alternatives --config java

here are 5 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/bin/java)
   2           java-1.7.0-openjdk.x86_64 (/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.161-2.6.12.0.0.1.el7_4.x86_64/jre/bin/java)
   3           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
   4           /usr/java/jdk1.8.0_161/jre/bin/java
   5           /usr/java/latest/bin/java

Enter to keep the current selection[+], or type selection number: 5

# java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
```

```
# alternatives --config javac

There are 5 programs which provide 'javac'.

  Selection    Command
-----------------------------------------------
   1           java-1.7.0-openjdk.x86_64 (/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.161-2.6.12.0.0.1.el7_4.x86_64/bin/javac)
*+ 2           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/bin/javac)
   3           /usr/lib/jvm/java-1.6.0-openjdk.x86_64/bin/javac
   4           /usr/java/jdk1.8.0_161/bin/javac
   5           /usr/java/latest/bin/javac

Enter to keep the current selection[+], or type selection number: 5

# javac -version
javac 1.8.0_161

```

Done :smiley: