Gradle process is not able to launch JVM with following VM args. Please help if there is a fix for this problem.
application {
applicationDefaultJvmArgs = ["--add-opens java.base/jdk.internal.loader=ALL-UNNAMED"]
mainClassName = 'com.gradle.jvmargs.MainTestClass'
}
ERROR LOGS:
Starting process ‘command ‘/usr/lib/jvm/java-11-openjdk-amd64/bin/java’’. Working directory: /home/sumitk/IdeaProjects/GradleJVMArgs Command: /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-opens java.base/jdk.internal.loader=ALL-UNNAMED -Dfile.encoding=UTF-8 -Duser.country=IN -Duser.language=en -Duser.variant -cp /home/sumitk/IdeaProjects/GradleJVMArgs/build/classes/java/main:/home/sumitk/IdeaProjects/GradleJVMArgs/build/classes/groovy/main:/home/sumitk/IdeaProjects/GradleJVMArgs/build/resources/main:/home/sumitk/.gradle/caches/modules-2/files-2.1/org.codehaus.groovy/groovy-all/2.3.11/f6b34997d04c1538ce451d3955298f46fdb4dbd4/groovy-all-2.3.11.jar com.gradle.jvmargs.MainTestClass
Successfully started process ‘command ‘/usr/lib/jvm/java-11-openjdk-amd64/bin/java’’
Unrecognized option: --add-opens java.base/jdk.internal.loader=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
:run (Thread[Execution worker for ‘:’,5,main]) completed. Took 0.015 secs.
The command shown in the log works perfectly if i run directly through command prompt. JVM get launched successfully with right VM parameter.
Following are the environment details:
Gradle 6.0.1
Build time: 2019-11-18 20:25:01 UTC
Revision: fad121066a68c4701acd362daf4287a7c309a0f5