Jenkins on Linux AWS can not start

Today, I have installed Jenkins on Linux AWS. Then start it, but an error as below.

[root@Jenkins_Server ~]# service jenkins restart
Shutting down Jenkins                                      [FAILED]
Starting Jenkins Mar 13, 2020 11:22:44 AM Main verifyJavaVersion
SEVERE: Running with Java class version 51, which is older than the Minimum required version 52. See https://jenkins.io/redirect/java-support/
java.lang.UnsupportedClassVersionError: 51.0
        at Main.verifyJavaVersion(Main.java:182)
        at Main.main(Main.java:142)

Jenkins requires Java versions [8, 11] but you are running with Java 1.7 from /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.231.x86_64/jre
java.lang.UnsupportedClassVersionError: 51.0
        at Main.verifyJavaVersion(Main.java:182)
        at Main.main(Main.java:142)

I have installed java Version 1.8.x. Check Java version on Linux AWS the default version 1.7.x.

[root@Jenkins_Server ~]# java -version
java version "1.7.0_231"
OpenJDK Runtime Environment (amzn-2.6.19.1.80.amzn1-x86_64 u231-b01)
OpenJDK 64-Bit Server VM (build 24.231-b01, mixed mode)
[root@Jenkins_Server ~]# echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.50.amzn1.x86_64

How to fixed it. I use the command below to switch JDK to Java version “1.8.x”. You can refer to the link here

sudo alternatives --config java

Link youtube

Now, I have started Jenkins is OK. Thank you for reading DevOpsRoles.com page

, , ,

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

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

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.