Quick note, and it’s not too hard, but took a few minutes to remember.

Amazon Linux comes with Java 1.7.0 installed. I wanted to upgrade to 1.8.0 for Elasticsearch 5.3

sudo yum -y install java-1.8.0-openjdk

 

Awesome!

$ java -version
java version "1.7.0_131"

 

Not Awesome

Just yank out 1.7.0

$ sudo yum remove java-1.7.0-openjdk

If you need both installed, maybe an old piece of code needs 1.7.0 and all your other stuff can deal with a global default of 1.8.0,   update your legacy apps to specify the JAVA_HOME environment variables to the real location of java-1.7.0, and update the global system like this:

$ which java
/usr/bin/java
$ ls -altr /usr/bin/java
lrwxrwxrwx 1 root root 22 Apr 20 17:00 /usr/bin/java -> /etc/alternatives/java
$ ls -latr /etc/alternatives/java
lrwxrwxrwx 1 root root 46 Apr 20 17:00 /etc/alternatives/java -> /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
$ sudo update-alternatives --config java

There is 1 program that provides 'java'.

Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java

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

Had I not removed Java 1.7 already, I’d have 1.7 and 1.8 in that list to choose from.

 

 

Short URL: http://bit.ly/2o8tKzM