I tried sudo yum update but it just keeps java "1.7.0_75". I need 1.8 for it to work with another application but can't figure out how to upgrade it.
Do I need to manually install it somehow? There's not much information on this on the internet as far as I can see.

java version "1.7.0_75"
OpenJDK Runtime Environment (amzn- u75-b13)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)

When I try update now:

[ec2-________]$ sudo yum update
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest                                         | 2.1 kB     00:00
amzn-updates/latest                                      | 2.3 kB     00:00
No packages marked for update

Is there anything else I need to do?


To remove java 1.7 and install java 1.8:

sudo yum install java-1.8.0
sudo yum remove java-1.7.0-openjdk
  • 1
    This is correct, thank you. I'm new to this as you can see. – K_dar Feb 3 '15 at 16:30
  • 8
    Changed the order of installation so that it doesn't remove the aws-apitools. – David Levesque May 9 '16 at 14:41
  • 1
    Note this will only install the Java Runtime. – johnnieb Jan 28 '17 at 18:35
  • 2
    @johnnieb you can get the full JDK with this: yum install java-1.8.0-openjdk-devel.x86_64 – orange80 May 17 '17 at 5:09
  • 4
    @orange80 I believe the command is yum install java-1.8.0-openjdk-devel -y – johnnieb May 17 '17 at 16:23

Install Java Runtime 1.8

sudo yum install java-1.8.0

or if you need a java compiler and other developer tools:

sudo yum install java-1.8.0-openjdk-devel

Then use the alternatives command to make Java 1.8 the default.

sudo /usr/sbin/alternatives --config java
sudo /usr/sbin/alternatives --config javac
# etc

If you prefer you can remove Java 1.7 with

sudo yum remove java-1.7.0-openjdk

but remove it after you installed Java 1.8 or the aws-apitools will also be removed as they depend on Java on being installed.

  • 15
    This is the most correct answer. If you follow the accepted answer you will lose aws-apitools. – Lionel Port Mar 23 '16 at 23:01
  • 8
    +1 for sudo /usr/sbin/alternatives --config java – Sanjay Verma Jul 17 '16 at 6:51
yum install java-1.8.0 -y
/usr/sbin/alternatives --set java /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
/usr/sbin/alternatives --set javac /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/javac
yum remove java-1.7.0-openjdk

protected by Community Jul 19 '17 at 14:57

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.