`
圣米格利托
  • 浏览: 58037 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

【转】Eclipse Access Restriction

阅读更多
Question: Access restriction: the type * is not accessible due to restriction on required library *.jar Access restriction:The method * is not accessible due to restriction on required library *.jar Description: Eclipse环境下,项目中导入某些JAR,使用这些JAR中的某些API。结果出现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。这种规避方式比较粗暴,个人支持第一种方案。 来源地址:http://hi.baidu.com/oritenson/blog/item/9b6c072a90a1dce199250a8e.html
分享到:
评论

相关推荐

    Eclipse访问策略设置

    在提供的文档"Eclipse Access restriction.docx"中,很可能详细介绍了如何执行这些步骤,并提供了实际的示例和最佳实践。这将帮助开发者理解如何在实际项目中应用访问策略,以保护系统安全性和合规性。 总的来说,...

    base64转换遇到问题解决方法

    1. Access restriction:在Eclipse中编写Java代码时,使用了BASE64Decoder,但Eclipse提示:Access restriction : The type BASE64Decoder is not accessible due to restriction on required library C:\Program ...

    sun.misc.base64decoder.jar下载

    sun.misc.BASE64Encoder找不到jar包的解决方法?... Access restriction : The constructor BASE64Decoder() is not accessible due to restriction on required library C:\Program files\java\jre6\lib\rt.jar

    Eclipse错误解决办法

    当出现"Access restriction: Class is not accessible due to restriction on required library"错误时,这通常是因为Eclipse的访问限制规则。要解决这个问题,可以通过以下步骤将错误级别改为警告: - `Windows -...

    解决eclipse导入rt包问题

    然而,在使用Eclipse开发环境中导入这两个类时,可能会遇到访问限制错误:“Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required library C:\Java\jre1.6.0_07\lib\rt...

    import com.sun.image.codec.jpeg.JPEGImageEncoder;包的下载

    Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required library C:\Java\jre1.6.0_07\lib\rt.jar 此时解决办法: Eclipse默认把这些受访问限制的API设成了ERROR。只要...

    Eclipse中设置jar的访问受限设置

    在使用Eclipse进行Java开发的过程中,有时会遇到“Access restriction”错误,这类错误通常发生在尝试访问某个类或者包时,Eclipse认为该类或者包的访问级别受到了限制。例如,当尝试导入一个项目时,可能会出现以下...

    Eclipse中引入com.sun.image.codec.jpeg包报错的完美解决办法

    但是,有时引入这两个包时会报出错误:`Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required library C:/Java/jre1.6.0_07/lib/rt.jar`。 解决方法一:修改全局属性 ...

    eclispe错误

    在错误信息中,我们看到 "Access restriction:The type JPEGCodec is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar",这表明你尝试访问的 `JPEGCodec` 类受到了...

    java识别验证码.docx

    Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required library C:\Java\jre1.6.0_07\lib\rt.jar ``` **解决方案:** 1. **调整Eclipse配置**:Eclipse默认将这些受...

    Heritrix的安装与配置

    例如,`Access restriction`错误是由于JRE的访问限制导致的。解决这个问题的方法是在项目构建路径中删除有问题的JRE库,然后重新导入。另一种方法是将错误级别设置为警告或忽略。 另一个可能遇到的错误是`...

Global site tag (gtag.js) - Google Analytics