idea运行时 警告WARNING: An illegal reflective access operation has occurred

在学习和使用ssm框架时,遇到以下提示idea运行时 警告WARNING: An illegal reflective access operation has occurred_第1张图片

查阅很多大佬的资料,发现都是建议将高版本的jdk退回至1.8及之前版本,我正在使用的是jdk1.9,正郁闷间发现一位大佬的评论,大意为添加jvm的options参数即可,尝试之后确实可行,发现很多人不清楚怎么在idea中修改options参数,所以将我的步骤分享一波,顺便感谢一下大佬@JavaISoCool。

原文章地址附上,大佬回复在评论中

https://blog.csdn.net/nangu0673/article/details/82820494

大佬原话附上:

在JVM options 添加下面的参数就好了(意思是:If the reflecting code is in a named module, ALL-UNNAMED can be replaced by its name.): --illegal-access=deny --add-opens java.base/java.lang=ALL-UNNAMED

好进入正题:

添加options:

--illegal-access=deny --add-opens java.base/java.lang=ALL-UNNAMED

idea运行时 警告WARNING: An illegal reflective access operation has occurred_第2张图片idea运行时 警告WARNING: An illegal reflective access operation has occurred_第3张图片

idea运行时 警告WARNING: An illegal reflective access operation has occurred_第4张图片

idea运行时 警告WARNING: An illegal reflective access operation has occurred_第5张图片

    注意:如果使用junit测试的时候也需要手动添加options参数

 

idea运行时 警告WARNING: An illegal reflective access operation has occurred_第6张图片

结束。

你可能感兴趣的:(java,jdk,spring,jvm,intellij,idea)