How Do You Install Java on an AWS Instance of RHEL?

Problem scenario
You are using RedHat Enterprise Linux 7.x in AWS.  How do you install Java?

Possible Solution #1
Use this posting as it is preferred. Below is an alternative.

Possible Solution #2
This will install Java 1.8.x.

1. Create a file named with this as the content:

yum -y install java-1.8.0-openjdk*
echo 'export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk' >> ~/.bashrc
source ~/.bashrc
sudo -s
sudo -s source /etc/environment

2.  Run this command: sudo -s source

3.  You are done.  To test, you can run java -version and echo $JAVA_HOME. If you are having network issues, you may want to view this posting.

Leave a comment

Your email address will not be published. Required fields are marked *