Issue
I'm trying to run a spring boot application with ZGC Garbage Collector, with following JVM options passed in build.gradle
:
bootRun {
jvmArgs = ["-XX:+UnlockExperimentalVMOptions", "-XX:+UseZGC", "-Xlog:gc*"]
}
While running an app (gradle bootRun
) I'm getting following error:
> Task :bootRun FAILED
Error occurred during initialization of VM
Option -XX:+UseZGC not supported
java -version:
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.6+10, mixed mode)
I'm running 10.15.2 (19C57) version of macOS (Catalina) if that helps. Is it only macOS issue?
Solution
You can find the details over the supported platforms under the ZGC wiki.
So as it seems like, you would have to move to JDK-14 to be able to use it with macOS.
Answered By - Naman
Answer Checked By - Katrina (JavaFixing Volunteer)