groovysh 给出调用目标异常

groovysh is giving invocation target exception

我最近安装了 groovy。

C:\Users\Shivendra Gupta>groovy -v
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/D:/IT%20Softwares/groovy-3.0.0-alpha-4/lib/groovy-3.0.0-alpha-4.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
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
Groovy Version: 3.0.0-alpha-4 JVM: 11.0.2 Vendor: Oracle Corporation OS: Windows 10

现在,当我 运行 groovysh 命令时,我收到错误:

此外,当 groovy控制台以奇怪的方式运行时:-

我认为非法反射访问警告可能是由于 jdk 11 的兼容性问题。这是否意味着我将无法使用 jdk 11 for groovy?有没有人遇到过类似的问题?我该如何解决这个问题?

编辑: 我刚刚安装了 java 9。我在使用 groovysh 和 groovyConsole 命令时遇到了完全相同的错误,并且在 运行nung groovy -v 上也收到了相同的警告命令

这是由于 JDK9/11 与 groovy 之间的兼容性问题,我通过安装 JDK 8.

解决了这个问题