问题

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

  1. 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. [NOIP2011提高组day2]-1-计算系数

    1.计算系数 (factor.cpp/c/pas) [问题描述] k n m给定一个多项式(ax+by)^k ,请求出多项式展开后(x^n)*(y^m)项的系数. [输入] 输入文件名为 factor ...

  2. CSS3学习笔记(4)—上下滑动展开的按钮

    最近写了一个动画,下面来看看我以前写的一个上下滑动展开的按钮效果: 这类的效果经常会在一些网站页面下载按钮处看到,当你鼠标悬浮在下载按钮时,会提醒你是否已注册,或者点击登录什么的小提示~~~~~ 一. ...

  3. .cxx_destruct crash

    开发过程中遇到 YXTBaseLabelCell .cxx_destruct崩溃,查了下,会在调用类的dealloc方法时调用cxx_destruct,于是看了下代码,找dealloc可能会崩溃的原因 ...

  4. 关于Ajax实现的简单示例

    一.代码示例 关于Ajax的基本概念(包括XMLHttpRequest对象及其相关方法属性)移步这里(w3school中文版)学习了解. <!doctype html> <html ...

  5. 页面渲染——简化paint复杂程度和区域

    Paint是填充像素并且最后合成在用户的屏幕上的过程. 通常是在管道中耗费最大的,你要尽可能的避免使用paint. 动画中使用除了transform和opacity的动画属性都将触发paint pai ...

  6. 【CQ18高一暑假前挑战赛3】标程

    [A:LCM] #include<bits/stdc++.h> using namespace std; #define ll long long int main() { ll a,b, ...

  7. liunx环境下安装tomcat

    第一:下载tomcat的安装包

  8. C/C++获取Linux系统CPU和内存及硬盘使用情况

    需求分析: 不使用Top  df  free 等命令,利用C/C++获取Linux系统CPU和内存及硬盘使用情况 实现: //通过获取/proc/stat (CPU)和/proc/meminfo(内存 ...

  9. samba 安装运行

    samba 安装步骤 1.若之前有安装过相关软件包,先卸载之:sudo apt-get autoremove samba samba-commonsudo apt-get autoremove sys ...

  10. 使用 NSData 分类实现,对 NSData 数据类型进行 AES 加密

    一般对NSData的数据类型进行加密,这里就将 .h .m 文件分享出来,有需要的可以直接粘贴使用.     下面是 .h 文件   #import <Foundation/Foundation ...