问题描述:
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.)