Search code examples
macosjenkinsmacos-high-sierra

How to run jenkins with old version of Java instead the latest default one on MacOS?


I'm setting up Jenkins on my Macbook (High Sierra), seems like the default version of Java is Java 9, which causes issue "java.lang.AssertionError: InstanceIdentity is missing its singleton"

I changed the Java home of my Mac from 9.x to 8 already, but when I reinstall, same trouble still comes along.

I checked the System Properties under Manage Jenkins/System Information, the value java.specification.version still is "9".

So how can I install Jenkins with old version of Java? Or any workaround for it?


Solution

  • Here is what worked for me with OS X 10.13.2 (High Sierra).

    1. I used "brew install jenkins" to install Jenkins. You can find instructions from http://flummox-engineering.blogspot.com/2016/01/installing-jenkins-os-x-homebrew.html, for example.

    2. Download JDK 8 from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

    3. Set your JAVA_HOME and JDK_HOME to point to the version you downloaded. (Put this is your .bash_profile if needed.) For example, export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home export JDK_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home

    4. Type in "jenkins --httpPort=9898" or whatever port is desired to start Jenkins.