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