Home > Database > Mysql Tutorial > body text

Eclipse Access Restriction

WBOY
Release: 2016-06-07 15:42:39
Original
1086 people have browsed it

出处: http://hi.baidu.com/oritenson/blog/item/9b6c072a90a1dce199250a8e.html Eclipse环境下,项目中导入某些JAR,使用这些JAR中的某些API。结果出现Access restriction错误,如下图: Accuse: Access restriction的原因是因为这些JAR默认包含了一系列的

出处:

http://hi.baidu.com/oritenson/blog/item/9b6c072a90a1dce199250a8e.html

 

 

Eclipse环境下,项目中导入某些JAR,使用这些JAR中的某些API。结果出现Access restriction错误,如下图:

Eclipse Access Restriction

Accuse:

Access restriction的原因是因为这些JAR默认包含了一系列的代码访问规则(Access Rules),如果代码中引用了这些访问规则所禁止引用类,那么就会提示这个错误信息。

Action:

一、既然存在访问规则,那么修改访问规则即可。打开项目的Build Path Configuration页面,打开报错的JAR包,选中Access rules条目,选择右侧的编辑按钮,添加一个访问规则即可。

二、网上的另外一种解决方案:Window - preference - Java - Compiler - Errors/Warnings界面的Deprecated and restricted API下。把Forbidden reference (access rules): 的规则由默认的Error改为Warning。

这种方案是修改整个Eclipse开发环境,将所有禁止访问的引用由原来的Error(默认)修改为Warning。这种规避方式比较粗暴,个人支持第一种方案。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!