问题

今天导入项目时Eclipse报错如下:

Access restriction: The type 'JPEGCodec' is not API (restriction on required library 'C:\Program Files\Java\jdk1.8.0_191\jre\lib\rt.jar')

第一次遇到这种错误,百度了下,原来是因为Eclipse默认把访问受限的API设置成了Error级别,所以才会编译报错。

解决方法

方法一(推荐)

直接将项目的JRE给remove掉,然后再重新将JRE添加到项目中,操作如下:

  1. 右键项目,选择Properties -> Java Build Path -> Libraries -> 选中JRE System Library [jdkxxxx] -> 选择Remove
  2. 接着选择Add Librariy...,重新加入JRE

方法二

修改Eclipse中关于访问受限的API的编译级别:

Window -> Preferences -> Java -> Compiler -> Errors/Warnings,选择Deprecated and restricted API,将其中的Forbidden reference(access rules)的级别选为Warning。

参考链接

Access restriction: The type 'JPEGCodec' is not API的更多相关文章

  1. Eclipse 编译错误 Access restriction: The type 'JPEGCodec' is not API (restriction on required library 'C:\Program Files\Java\jre7\lib\rt.jar')

    解决方案:          Project -> Properties ->Java Build Path -> libraries,         先 remove 掉 JRE ...

  2. 关于Access restriction: The type 'Application' is not API (restriction on required library)

    原文链接:http://rxxluowei.iteye.com/blog/671893 今天写第一次写JavaFX的入门程序就GG 遇到了导入API的问题,无奈疯狂地通过网络找解决方案.. 我的问题是 ...

  3. Access restriction: The type 'BASE64Encoder' is not API

    问题的原因好像是这个方法不是安全的,所以不推荐使用,我是在做毕设时要用到的所以就直接用了(毕设要求没有那么严格的要求)

  4. Access restriction: The type 'Unsafe' is not API

    错误:Access restriction: The type 'Unsafe' is not API Eclipse中有一种叫做存取限制的机制,来防止你错误使用那些非共享的API.通常来说,Ecli ...

  5. Java,AWTUtilities,eclipse报编译错误:Access restriction: The type 'AWTUtilities' is not API (restriction on required library 'C:\Program Files\Java\jre7\lib\rt.jar')

    [场景]调用com.sun.awt.AWTUtilities时,eclipse提示编译错误: Access restriction: The type 'AWTUtilities' is not AP ...

  6. Access restriction: The type 'BASE64Decoder' is not API

    Access restriction: The type 'BASE64Decoder' is not API (restriction on required library 'C:\Program ...

  7. exception Access restriction: The type 'BASE64Encoder' is not API

      Created by Marydon on 1.情景展示 在eclipse中切换jdk版本后,报错信息为:exception Access restriction: The type 'BASE6 ...

  8. eclipse报Access restriction: The type 'BASE64Decoder' is not API处理方法

    今天从svn更新代码之后,由于代码中使用了BASE64Encoder  更新之后报如下错误: Access restriction: The type ‘BASE64Decoder’ is not A ...

  9. eclipse错误:Access restriction: The type 'BASE64Decoder' is not API

    Access restriction: The type ‘BASE64Decoder’ is not API (restriction on required library ‘D:\java\jd ...

随机推荐

  1. ios怎样在一个UIImageButton的里面加一些自己定义的箭头

    能够採用例如以下方法,写一个函数: -(UIImage*) getOneImageButtonWithArrow{ //tmpView做附控件 UIView *tmpView = [[UIView a ...

  2. Photoshop颜色通道实例

    PHOTOSHOP学到这会儿,我们不得不来学学枯燥乏味的颜色理论了,因为如果再不学,就难以学下去了.眼下我们就遇到了难点:颜色通道.前面在初识通道的时候,我已经说过:当你打开一张照片(RGB模式)的时 ...

  3. cassandra 存储list数组

    demo如下: CREATE TABLE users3 ( user_id text PRIMARY KEY, first_name text, last_name text, emails list ...

  4. PHP自定义网站根目录

    1.打开httpd.conf配置文件(xampp下apache文件夹中的conf里) Ctrl + F 查找documentroot 找到结果 改好后保存,并重启apache

  5. BZOJ_2901_矩阵求和_前缀和

    BZOJ_2901_矩阵求和_前缀和 Description 给出两个n*n的矩阵,m次询问它们的积中给定子矩阵的数值和. Input 第一行两个正整数n,m. 接下来n行,每行n个非负整数,表示第一 ...

  6. python逼格提升

    1.合并可以匹配的条件 s1 = 7 if s1 > 5 and s1 < 10: print(s1) s1 = 7 if 5 < s1 < 10: print(s1) 2.i ...

  7. hibernate 学习 一 基本概念

    1: Hibernate对JDBC进行封装,以面向对象的方式对关系型数据库进行操作. 2:  Hibernate的配置文件: hibernate.properties  或者  hibernate.c ...

  8. bzoj2687

    整体二分+决策单调性 这个方法已经忘了... 决策单调性是指dp[i]由dp[1]->dp[i-1]更新,那么当dp[j]比dp[k]优且j>k时,对于i->n j都比k优 通过这个 ...

  9. sizeToFit的学习与认知

    今天一扫前两日的坏心情,终于有心情平静下来,今天我是根据网络上的一些资料进行学习,今天学习的内容是 sizeToFit() 方法在不方便手动布局的场景中的使用. 首先感谢资料的提供者:参考1 参考2 ...

  10. 【225】ArcEngine 实现要素添加 & 删除

    参考:ArcGIS Engine效率探究——要素的添加和删除.属性的读取和更新 删除要素 //添加图层,显示在最上面 axMapControl1.AddShapeFile(@"D:\01-业 ...