sudo yum -y install java-1.8.0-openjdk
#After the install is complete
JAVA_PATH=$(sudo alternatives --display java | grep priority | grep 1.8 | cut -d ' ' -f 1)
sudo alternatives --set java $JAVA_PATH
# java -Check with version
The confirmation environment is Amazon Linux ʻami-ceafcba8` (amzn-ami-hvm-2017.09.1.20180115-x86_64-gp2)
Regardless of whether it is good or bad, it is assumed that you want to install packages automatically with a shell script. In my case, I installed 1.8.0 on Amazon Linux and encountered it when trying to use embulk
I thought I'd remove 1.7.0 with yum remove
, but I had ʻaws-apitools that depended on it, so I used ʻalternatives
as an alternative.
It seems that the method of switching with ʻalternatives --config java` has come to the top.
Recommended Posts