Access restriction: The type FtpClient is not accessible due to

 

在做ftp,代码中引用
import sun.net.ftp.FtpClient;
报如下错误
Access restriction: The type FtpClient is not accessible due to restriction on required library D:\Program Files\Java\jre6\lib\rt.jar



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

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

你可能感兴趣的:(java,eclipse,System,Access,import,library)