Access restriction: The type FileURLConnection is not accessible due to restriction

问题: 

Access restriction: The type FileURLConnection is not accessible due to restriction on required library C:\Program Files\Java\jdk1.6.0_20\jre\lib\rt.jar


解决方案:

方案一:这是 JRE 的访问限制导致报错,在对应的工程上右键单击选择“Build Path->Configure Build Path …”,然后选择 Library 选项卡,将“JRE System Library”删除然后重新导入一下即可修复。


方案二:选择“Windows->Preferences->Java->Compiler->Errors/Warnings”找到“Deprecated and restricted API”下的“Forbidden reference (access rules)”,将默认设置“Error”改为“Warning”或“Ignore”。



你可能感兴趣的:(Access restriction: The type FileURLConnection is not accessible due to restriction)