Disable JDK 11 warning message

When we run groovy script on Java/JDK 11, we will get bellow warning message.

$ groovy -e 'print "Hello Groovy"'
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/Users/sundaram/.sdkman/candidates/groovy/current/lib/groovy-2.5.6.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

To disable these warning message, set this environment variable.

export GROOVY_TURN_OFF_JAVA_WARNINGS=true

When we run the script again, most of the warning messages will be supressed.

$ groovy -e 'print "Hello Groovy"'
WARNING: package sun.awt.windows not in java.desktop

To remove this awt warning message, remove below argument.

Remove --add-opens=java.desktop/sun.awt.windows=ALL-UNNAMED from your startGroovy shell script.

Thansk for Paul King, giving this answer.


Copyright © 2004, Software Groups