Cloudfoundry with OpenJDK 11: add JBP_CONFIG_OPEN_JDK_JRE


Posted by Steven

I just upgraded a Java project from Java 8 to OpenJDK 11. The project is running on a Cloudfoundry, using the Java buildpack. After successful deployment with the new Java 11, the application won't start properly and threw the a java.lang.UnsupportedClassVersionError. The solution for this is to add the following variable in Cloudfoundry:

  1. "JBP_CONFIG_OPEN_JDK_JRE" with value "{ jre: { version: 11.+ }}"

This can also be done via manifest file:

  1. ---
  2. applications:
  3. - name: myapp
  4. instances: 1
  5. path: ./target/myapp-0.0.1-SNAPSHOT.jar
  6. buildpacks:
  7. - java_buildpack_cached
  8. env:
  9. JBP_CONFIG_OPEN_JDK_JRE: '{ "jre": { version: 11.+ } }'

This tells the Java buildpack to explicitely use Java 11 instead of the default Java 8. Thanks to my coworker Stefan for pointing this out. :)

Category: 
Share: