Skip to content

Lower the Java version requirement from 14 to 11

Robin Schimpf requested to merge theobisproject/joularjx:lower-jdk-to-11 into main

The 'getSystemCpuLoad' method was renamed in Java 14 has the same behaviour as the new 'getCpuLoad' method.

Reading the update from the blog here https://www.noureddine.org/articles/measure-the-energy-consumption-of-java-applications-with-jalen I expected the project to work on Java 11 and was suprised to see I need Java 14. Since Java 11 is a LTS release many business applications (including the one I am testing) will only target those. Requiring a newer version will possibly exclude many projects. Since the old and from Java 14 on deprecated method is functionally the same and currently in Java 18 not marked for removal the method will stay there for some time.

The cleanest way would be to build a multi-release jar but I have no knowledge there and also do not know if this works in a JVM agent.

Using the maven.compiler.release argument instead of maven.compiler.source and maven.compiler.target will ensure that the compilation will fail on newer JDKs when a used API is not available in the targeted version.

Merge request reports