not accessible due to restriction

 not accessible due to restriction 

 

在引用如下包报错
import sun.swing.DefaultLookup;

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

解决办法

sun.net包里的,在eclipse里默认是不让用的。解决办法是自定义access rules

工程上右键->工程属性->java builder path->Libraries标签,点击JRE System Library里面的Access rules,add sun/** 为accessible,如果该项存在,就edit

来源:http://blog.chinaunix.net/uid-9622484-id-2182348.html

posted @ 2013-01-04 11:30  清新每一天  阅读(304)  评论(0编辑  收藏  举报