I try to update Jenkins frequently to keep the security patches up to date. As seen in my previous blog posts, the way to keep it up to date is to use CloudFormation, resulting in a fairly immutable type of architecture. The way to make a change to the build server is to update the CloudFormation template. The way to update Jenkins is to run the backup / destroy script. When the server is destroyed, the Load Balancer will start up a new instance.

This usually works flawlessly—until Jenkins needs a new version of Java. Figuring this out wasn’t easy, and then determining the fix wasn’t easy either.

Fortunately, I’ve done the work for you, so hopefully this will solve your problem quickly.

Jenkins 2.60.1 now requires Java 8. Previous versions required Java 7. Let’s take a look at how to get Java 8 on your AWS systems.

Jenkins Instance (with CloudFormation)

If you are using the CloudFormation template that I have shared previously, you can go to AWS CloudFormation and update the stack.

Select your stack and click Update. Upload the new CloudFormation template and AWS will calculate the changes, applying them to the governed instances.


Jenkins EC2 Build Nodes


  • Amazon Linux AMIs (CentOS style)
  • Jenkins
  • Amazon EC2 Plugin


  • Manage Jenkins
  • Configure System
  • Amazon EC2 section
  • Go through your AMIs / build node configurations
  • Prepend the Init script fields with this:

    sudo yum install -y java-1.8.0-openjdk.x86_64
    sudo /usr/sbin/alternatives --set java /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
    sudo /usr/sbin/alternatives --set javac /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/javac
    sudo yum remove java-1.7

Amazon Linux AMI machines

This breaks a lot of rules, but if you don’t have a central place for configuration (Puppet, Ansible, Chef, etc), and you need to install Java 8, here is the script to use:

sudo yum install -y java-1.8.0-openjdk.x86_64
sudo /usr/sbin/alternatives --set java /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
sudo /usr/sbin/alternatives --set javac /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/javac
sudo yum remove java-1.7

After you run it, at the very minimum, start a list of the commands you run. Open a Google Doc and paste it there. You will thank yourself many times over when you have to rebuild your server.

  • Updating to Jenkins 2.60.1 requires Java 8 on your system.
  • Amazon Linux AMIs by default have Java 7 installed.
  • Upgrading your systems to Java 8 is as simple as executing a couple of commands.
SwiftOtter, Inc.
It relates to <a href="" class="plain-tag">Magento 2</a>, <a href="" class="plain-tag">Magento 1</a>, <a href="" class="plain-tag">Continuous Integration</a> and <a href="" class="plain-tag">Jenkins</a>.
Joseph Maxwell - president / senior developer at Swift Otter

President / senior developer at SwiftOtter - @swiftotter_joe