Issue
Following this post :
jfr is supported natively in openjdk 11
and it is confirmed by the features list of OpenJDK 11:
328: Flight Recorder
However, from this DZone article, about using JFR-linked option -XX:+UnlockCommercialFeatures
:
OpenJDK doesn’t recognize this option
And when I try for ex. with Gradle: ./gradlew clean -Dorg.gradle.jvmargs="-XX:+UnlockCommercialFeatures"
I get
Process command line: C:\Program Files\AdoptOpenJDK\jdk-11.0.11.9-hotspot\bin\java.exe -XX:+UnlockCommercialFeatures (...)
Unrecognized VM option 'UnlockCommercialFeatures'
What am I missing here ?
Solution
JFR was a commercial feature in Oracle Java up to Java 1.8 that needed to be specially enabled (using -XX:+UnlockCommercialFeatures
).
With Java 11 and later it is no longer a commercial feature so you don't need this flag.
Actually the linked article states:
JFR Packaging Differences
Oracle JDK 11 emits a warning when using the-XX:+UnlockCommercialFeatures
option, whereas OpenJDK doesn’t recognize this option and reports an error.
And the example below that the author shows doesn't use the -XX:+UnlockCommercialFeatures
.
Answered By - Thomas Kläger