Access restriction: The type XXX is not accessible due to restriction on required library XXX

今天新建一个类的时候,很多元素报错,说引用不到:

 Access restriction: The type NoSuchPortException is not accessible due to restriction on required library C:\Java\jre7\lib\ext\comm.jar

Access restriction: The type XXX is not accessible due to restriction on required library XXX_第1张图片

 这个comm.jar 是在项目中后来引用的,并不是java自带的,



那怎样解决这个引用不到的问题呢?网上搜到了答案:

右击项目,Build Path -> Configure Build Path,在对话框中选择 Order and Export 标签,把comm.jar的位置移动到JRE System Library 的上面

Access restriction: The type XXX is not accessible due to restriction on required library XXX_第2张图片

效果如下:

Access restriction: The type XXX is not accessible due to restriction on required library XXX_第3张图片


报错信息消失。


你可能感兴趣的:(Access restriction: The type XXX is not accessible due to restriction on required library XXX)