问题

今天导入项目时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. Linux就该这么学--命令集合8(命令行通配符)

    1.查看sda开头的所有设备文件: ls /dev/sda* 2.查看sda后面只有一个字符的设备文件: ls /dev/sda? 3.查看sda后面包含0-9数字的设备文件: ls /dev/sda ...

  2. Codeforces Round #376 (Div. 2) C. Socks —— 并查集 + 贪心

    题目链接:http://codeforces.com/contest/731/problem/C 题解: 1.看题目时,大概知道,不同的袜子会因为要在同一天穿而差生了关联(或者叫相互制约), 其中一条 ...

  3. bleve搜索引擎是支持基于field搜索的

    Query String Query The query language query allows humans to describe complex queries using a simple ...

  4. 关于Froala Editor的简单使用

    1.添加样式表 <!-- 核心样式表 --> <link rel="stylesheet" href="${ctx}/resources/froala_ ...

  5. v-for指令用法二

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...

  6. RAM的分类

    转载自:http://wenku.baidu.com/view/b17d73244b35eefdc8d333ab.html RAM(随机存储器)可以分为SRAM(静态随机存储器)和DRAM(动态随机存 ...

  7. 三剑客之awk数组实战

    shell数组for循环 第一种: #!/bin/sh array=(1 2 3) for i in ${array[*]}  do    echo $i done   第二种: #!/bin/sh ...

  8. 「HNOI2004」「LuoguP2292」L语言(AC自动机

    题目描述 标点符号的出现晚于文字的出现,所以以前的语言都是没有标点的.现在你要处理的就是一段没有标点的文章. 一段文章T是由若干小写字母构成.一个单词W也是由若干小写字母构成.一个字典D是若干个单词的 ...

  9. TX2 刷机过程

    1.拿到板子,上电 (1)输入 ls (2)进入NVIDIA-INSTALLER/ (3)再sudo ./installer.sh 账户和密码都是:nvidia (4)sudo reboot 参考博客 ...

  10. linux下实现目录即文件的完整删除

    功能: 1.删除目录 2.删除文件 3.删除不为空的目录即下属文件 #ifndef _DELETE_FILE #define _DELETE_FILE #include <sys/stat.h& ...