After ugrading Java to JDK 11, Jenkins fails to start due to Unrecognized VM option

Article ID:4569312535195
2 minute readKnowledge base

Issue

  • After upgrading to JDK 11, Operations Center and/or Controllers fail to start with an issue like the following:

      Unrecognized VM option '<JVM OPTION>'
      Error: Could not create the Java Virtual Machine.
      Error: A fatal exception has occurred. Program will exit.

Explanation

Java 11 (and mainly Java 9) removes support for many Java options:

When upgrading from Java 8 to Java 9+, unsupported and deprecated options must be removed and if possible replaced.

See CloudBees Supported Java Version for information about Java Versions support.

Resolution

Many of the previously recommended JDK 8 GC logging arguments are no longer supported:

  • -Xloggc:${PATH}/gc.log / -Xloggc:${PATH}/gc-%t.log

  • -XX:NumberOfGCLogFiles=2

  • -XX:+UseGCLogFileRotation

  • -XX:GCLogFileSize=100m

  • -XX:+PrintGC

  • -XX:+PrintGCDateStamps

  • -XX:+PrintGCDetails

  • -XX:+PrintHeapAtGC

  • -XX:+PrintGCCause

  • -XX:+PrintTenuringDistribution

  • -XX:+PrintReferenceGC

  • -XX:+PrintAdaptiveSizePolicy

They must be replaced by the single -Xlog argument as documented in Prepare Jenkins for support:

  • -Xlog:gc*=info,gc+heap=debug,gc+ref*=debug,gc+ergo*=trace,gc+age*=trace:file=${PATH}/gc.log:utctime,pid,level,tags:filecount=2,filesize=100M

Where:

  • filecount=2 is the equivalent of the deprecated -XX:NumberOfGCLogFiles=2

  • filesize=100M is the equivalent of the deprecated -XX:GCLogFileSize=100m

  • file=${PATH}/gc.log / file=${PATH}/gc-%t.log is the equivalent of the deprecated -Xloggc:${PATH}/gc.log / -Xloggc:${PATH}/gc-%t.log

*Note: If the unsupported arguments is not among the one listed above, have a look at the following documentations to understand if it may simply be removed or what it may be replaced with: