Help us understand the problem. What is going on with this article?

Java SE Development Kit 8u161 - setup with alternatives

More than 3 years have passed since last update.
  • yum localinstall

# 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
 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...
  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 

  jdk1.8.x86_64 2000:1.8.0_161-fcs                                                                                       

  • alternatives install

# 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
# 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-
   2           java-1.7.0-openjdk.x86_64 (/usr/lib/jvm/java-1.7.0-openjdk-
   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-
*+ 2           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-
   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:

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away