我只是尝试使用Java 9运行服务器,并收到下一个警告:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/home/azureuser/server-0.28.0-SNAPSHOT.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
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
我想隐藏此警告而不--illegal-access=deny
在启动过程中添加到JVM选项。就像是:
System.setProperty("illegal-access", "deny");
有什么办法吗?
建议使用JVM选项的所有相关答案,我想从代码中关闭它。那可能吗?
需要澄清的是-我的问题是关于从代码而不是通过类似问题中所述的JVM参数/标志来启用此警告。