【场景】调用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. Sqoop-1.4.6安装部署及详细使用介绍

    之所以选择Sqoop1是因为Sqoop2目前问题太多.无法正常使用,综合比较后选择Sqoop1. Sqoop1安装配置比较简单 一.安装部署 (1).下载安装包 下载地址:http://archive ...

  2. 学习笔记之Nginx

    NGINX | High Performance Load Balancer, Web Server, & Reverse Proxy https://www.nginx.com/ flawl ...

  3. 如何在eclipse 里面调试java.lang包的代码

    1.  在Eclipse中,Window->Preferences->Java->Compiler,确保以下选项都勾选上 2. 在Eclipse中,Window->Prefer ...

  4. mysql查询中取差集的问题

    有个场景 现在有个打卡的记录表(daka),记录了用户每天的打卡信息,同时还有个运动打卡表(sport_daka),如果用户有运动打卡则在运动打卡表里面记录. 现在要统计用户的每天的打开信息,包括运动 ...

  5. 修改了jdk在环境变量中的路径怎么cmd中的jdk版本没有变

    把path路径下的jdk配置放在前面%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot ...

  6. redis作为mysql的缓存服务器(读写分离)

    转自:https://www.iyunv.com/thread-52670-1-1.html 一.redis简介Redis是一个key-value存储系统.和Memcached类似,为了保证效率,数据 ...

  7. 使用CacheCloud管理Redis实例

    转载来源:http://www.ywnds.com/?p=10610 一.CacheCloud是什么? 最近在使用CacheCloud管理Redis,所以简单说一下,这里主要说一下我碰到的问题.Cac ...

  8. 用tmux工具给linux命令行分栏

    介绍 有时候我们需要在命令行里同时开多个程序,但是每个程序都会占用命令行,这时候可以用tmux,给命令行界面分栏. 基本概念 tmux是分多层的 会话>窗口(我下文称作:页)>面板(或者叫 ...

  9. MySQL中授权(grant)和撤销授权(revoke

    MySQL 赋予用户权限命令的简单格式可概括为:   grant 权限 on 数据库对象 to 用户   一.grant 普通数据用户,查询.插入.更新.删除 数据库中所有表数据的权利 grant s ...

  10. 小众Python库介绍

    Python 是世界上发展最快的编程语言之一.它一次又一次地证明了自己在开发人员和跨行业的数据科学中的实用性.Python 及其机器学习库的整个生态系统使全世界的用户(无论新手或老手)都愿意选择它.P ...