Jdk 11 Migration

JDK 1.11 is the next LTS (Long Term Support) Release.

A lot of Enterprise Customers are still with JDK 1.8, but nowadays you need to provide migration path to JDK 1.11 (or to JDK 1.14 LTS).

JDK11 will be supported by Amazon Corretto at least up to 2024, so it seems a good candidate for a migration target.
Maven is highly recommended as build system, so we will focus on this use case.

JDK11 also does not provide 32bit versions anymore, so beware old operating system are outside at cold.

Migration steps

  1. Read the Oracle documentationon this subject
  2. Remember to download the OpenJDK version, because the Oracle one is no longer free for production use.
  3. Update your maven compiler plugin
  4. The new JDK 9 modular system needs to declare the java module you are going to use.
    We have no trouble using updated maven dependencies in a typical spring boot project.
  5. The Garbage-First Garbage Collector (G1 GC) is the default garbage collector in JDK 9 and later releases.
    It is the low-latency garbage collection. The most important configuration default is
    -XX:MaxGCPauseMillis=200
    which try to guarantee a maximum 200ms pause time.
    You can already configure JDK 8 to use it, so we recommend starting using GC1 on JDK 8 to ease migration

 

Conclusions

A Spring Boot 2.x projects with Vaadin 14 re-compile without troubles in JDK 11.
The new libraries take care of the new deprecations, which are a lot between JDK 8 and  11.
The JDK now prohibits illegal access to  private implementations (like com.sun.*), remove JavaFX, DerbyDB and a lot of legacy stuff. Also CORBA and JAXWS  was removed, along with javaws command. JAX-WS is provided by EE specification, and jar implementations seems available into Maven repositories.

The lack of a JDK implementation seems a trouble to us, because in the early days of jaxws you were forced to use the application server version (always older and bugged) instead of the default jdk bundled one.

The Maven JDeps Plugin is suggested on some blogs but it failed with “Exit code: 1 – The command line is too long.” under Windows, with no easy solution. Consider running it manually if you have a very large codebase.

As already suspected, less pivotal technologies (like JavaFX & Derby) was removed for lack of interest. The removal of the Javascript Engine is a problem because if you dare to use it, now you need to plug it and rework a bit your code.