您的位置:首页 > 理论基础 > 计算机网络

The type HttpExchange is not accessible due to restriction on required library 错误

2014-04-10 17:25 281 查看
参考:http://stackoverflow.com/questions/860187/access-restriction-on-class-due-to-restriction-on-required-library-rt-jar

问题描述:

import com.sun.net.httpserver.HttpExchange;

报错

Access restriction: The type HttpExchange is not accessible due torestriction on required library C:\Program Files\Java\jre7\lib\rt.jar

解决:

JRE System Library 从 Libraries 中删除,然后重新添加 JRE
System Library


原因:

工程中存在多个jar中的多个class冲突,其中只有一个class是正确的class。

删除 JRE
System Library 后重新添加,会让正确的class成为首选class,从而被正确找到。

(This
works because you have multiple classes in different jar files. Removing and re-adding the jre lib will make the right classes be first. If you want a fundamental solution make sure you exclude the jar files with the same classes.)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐