java 报错 the type JOptionPane is not accessible due to restriction on required library ×

来源:互联网 发布:淘宝违禁品怎么防排查 编辑:程序博客网 时间:2024/06/15 08:13

报错描述

Description Resource Path Location Type Access restriction: The method showInputDialog(Component, Object) from the type JOptionPane is not accessible due to restriction on required library /usr/lib/jvm/java-8-oracle/jre/lib/rt.jar

原因:类库权限不够无法访问 JOPtionPane。

解决办法

设置权限:
Eclipse->project->properties->Java Build Path->Libraries->Java System Libraries->Access rules下:
如果有javax/swing/JOptionPane 直接勾选,如果没有:
点击右边的Edit,弹出Type Access Rules:
Add:选择Accessiable,在rule pattern中输入:

javax/swing/JOptionPane

点击 OK
搞定收工

0 0
原创粉丝点击