【场景】调用com.sun.awt.AWTUtilities时,eclipse提示编译错误:

Access restriction: The type 'AWTUtilities' is not API (restriction on required library 'C:\Program Files\Java\jre7\lib\rt.jar')

【分析】eclipse项目默认的jre版本较早。

com.sun.awt.AWTUtilities是在JDK 6 update10中增加的。

【解决】更换JRE

方案一:为eclipse更换默认JRE

方案二:为项目更换JRE

1、项目上右击,快捷菜单,Build Path -> Configure Build Path...

2、列表树中选中Java Build Path,选项页中选中Libraries页

3、选中JRE项,Remove

4、Add Library

5、选中JRE System Library,Next

6、选中Alternate JRE,下拉列表中选择您的JRE,Finish

7、OK

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

  1. Access restriction:The type JPEGCodec is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar 报错

    报错: Access restriction:The type JPEGCodec is not accessible due to restriction on required library C ...

  2. Access restriction:The type JPEGCodec is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar

    解决方法: Project -> Properties -> libraries, 先remove掉JRE System Library,然后再Add Library重新加入. ===== ...

  3. 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 ...

  4. Access restriction: The type BASE64Encoder is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar

    解决方案:在configure build path 中去掉 jre system library,然后重新加载jre system library.....

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

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

  6. 关于在调用JAVAFX相关包时遇到Access restriction: The type 'Application' is not API (restriction on required library)的解决方法

    点击工具栏的Project->Properties->Java Build Path->Libraries-> 双击第一项 点击Add添加允许javafx 然后就不会报错了

  7. 启动Eclipse时,出现 “Failed to load the JNI shared library "C:\Program Files\java\jdk1.7.....\jvm.dll"

    原因1:给定目录下jvm.dll不存在. 解决方法:(1)重新安装jre或者jdk并配置好环境变量. (2)copy一个jvm.dll放在该目录下. 原因2:eclipse的版本与jre或者jdk版本 ...

  8. 怎么在eclipse中查到这个类用的是哪个jar的类和Eclipse 编译错误 Access restriction:The type *** is not accessible due to restriction on... 解决方案

    找到了一个办法,你先按F3,然后点击Change Attached Source..按钮,在弹出的框里有个路径,我的路径是D:/SNFWorkSpace/JAR/~importu9.jar,然后你去引 ...

  9. Eclipse 编译错误 Access restriction:The type *** is not accessible due to restriction on... 解决方案

    报错: Access restriction:The type JPEGCodec is not accessible due to restriction on required library C ...

随机推荐

  1. Apollo分布式配置中心部署以及使用

    一.简介Apollo(阿波罗)是携程框架部门研发的分布式配置中心,能够集中化管理应用不同环境.不同集群的配置,配置修改后能够实时推送到应用端,并且具备规范的权限.流程治理等特性,适用于微服务配置管理场 ...

  2. 廖雪峰Java4反射与泛型-1反射-4调用构造方法

    1.Class.newInstance()只能调用public的无参数构造方法 public class Main { public static void main(String[] args) t ...

  3. Socket传输简单的信息以及粘包问题的解决

    一.简单的socket程序——传输简短文字: # -*- coding: utf-8 -*- # -*- Author: WangHW -*- import socket whw_client = s ...

  4. [UE4]修改枪支碰撞体

    一.Simple Collision:显示简单碰撞体,Comlex Collision:显示复杂碰撞体 二.添加简单和复杂碰撞体 三.自动生成复杂精确的碰撞体

  5. [SQL Server]无法创建 SSIS 运行时对象,请验证 DTS.dll 是否可用及是否已注册

    很大可能是SQL Server Management Studio(SSMS)版本与当前操作系统不兼容造成的,与数据库本身没有关系,这种情况基本无解,不过可以使用其他机器连本机数据库导入导出数据. 今 ...

  6. python 打印调用栈

    import traceback def BBQ(): traceback.print_stack() 引入 traceback 包,在某个函数中执行 traceback.print_stack().

  7. elastalert新增自定义警告推送

    举例,博主公司有自己的内部通讯工具(类似QQ),接下来用IM代称该工具.于是希望elastalert的警告推送可以支持IM的公众号群发功能. 等博主这个月知识库写了再来补充hah

  8. 在同一个Linux上配置多个git账户

    1.首先在~/.ssh目录下执行 ssh-keygen -t rsa -C "miaoying.new@qq.com" 其中 -C "miaoying.new@qq.co ...

  9. Jquery ajax 参数 详解

    Jquery ajax 参数主要如下: url: 要求为String类型的参数,(默认为当前页地址)发送请求的地址. type: 要求为String类型的参数,请求方式(post或get)默认为get ...

  10. MySQL免安装配置(亲测过,请放心借鉴)

    下载地址:https://dev.mysql.com/downloads/mysql 1.mysqld --initialize-insecure  初始化 2.mysqld install  安装服 ...