小编Nik*_*rov的帖子

如何在没有JVM参数的情况下隐藏java 9中的"非法反射访问"警告?

我只是尝试用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
Run Code Online (Sandbox Code Playgroud)

我想隐藏此警告而不--illegal-access=deny在启动期间添加JVM选项.就像是:

System.setProperty("illegal-access", "deny");
Run Code Online (Sandbox Code Playgroud)

有没有办法做到这一点?

建议使用JVM选项的所有相关答案,我想从代码中关闭它.那可能吗?

澄清 - 我的问题是关于从代码中转发此警告而不是通过类似问题中所述的JVM参数/标志.

java jvm netty java-9

50
推荐指数
6
解决办法
5万
查看次数

标签 统计

java ×1

java-9 ×1

jvm ×1

netty ×1