The type javax.swing.JComponent cannot be resolved. It is indirectly referenced from required .class files
一段简单程序, frame.add(lbl);出现 问题。 也不知道为什么就是这里, 而我Ctrl + Shift + T 确实也是没有发现 JComponent 。
public void displayImage(String title, Image img, int x, int y)
{
ImageIcon icon=new ImageIcon(img);
JFrame frame=new JFrame(title);
JLabel lbl=new JLabel(icon);
frame.add(lbl);// ERROR
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setLocation(x, y);
frame.setVisible(true);
}
奇了怪了!我猜是jdk版本的问题,但是为什么呢? 难道不能用jdk8 ? 可是项目的其他代码都是依赖jdk8 的?
网上查看半天没有找到解决方案! stackoverflow 也没有! 郁闷! 后面偶然发现这个 :
http://blogs.candoerz.com/question/155925/java-swing-component-cannot-be-resolved.aspx
我大概明白了,应该还是jdk8 在myeclipse10 的不兼容的问题。 具体来说是我的 myeclipse10 的java compliation level 只能是 7, 所以。。。

换成 ideaj, 问题解决! 又是 jdk8 在myeclipse 的不兼容的问题啊!
The type javax.swing.JComponent cannot be resolved. It is indirectly referenced from required .class files的更多相关文章
- eclipse中java文件报错:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
问题:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class fi ...
- The type java.lang.String cannot be resolved. It is indirectly referenced from required .class files
最近在做J2ME开发项目,配置环境一切OK,但是打开项目时某些文件提示: The type java.lang.String cannot be resolved. It is indirectly ...
- 部署hibernate框架项目时出现问题:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files.
基本情况: (这些其实关系不大)我是直接impor导入HibernateDemo项目到eclipse中的,该项目的hibernate版本是3.6.7.Final版,使用了Hibernate Tools ...
- The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
The type java.lang.Object cannot be resolved.It is indirectly referenced from required .class files ...
- 问题1-The type java.lang.String cannot be resolved. It is indirectly referenced from required .class files
问题一:The type java.lang.String cannot be resolved. It is indirectly referenced from required .class f ...
- The type java.lang.AutoCloseable cannot be resolved. It is indirectly referenced from required .class files
出现问题: The type java.lang.AutoCloseable cannot be resolved. It is indirectly referenced from required ...
- The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files.
参照 http://stackoverflow.com/questions/24301986/the-type-java-lang-charsequence-cannot-be-resolved-in ...
- java报错:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
看包的路径是否对对:比如这样不对(...src/object/obietc) 其它解决方法转载: https://www.cnblogs.com/yadongliang/p/5918228.html ...
- 当你在web项目下新建一个class时package位置如果发生红色波浪错误,提示为”The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files“
问题是这样的如下图: 问题的原因: 1.配置tomcat7.0的时候自己设置了jre的版本1.8,而没有用myeclipse10自带的jre1.6,导致了出现了差错!
随机推荐
- 17行代码解决微信小程序图片延迟加载
js 页面 Page({ data: { realScrollTop: 0,//页面滚动距离 driveHeight //屏幕高度可初始化设置 }, scroll(e){ if(e.detail.sc ...
- synchronized基础
synchronized 例子 例1,没有同步的时候运行同一个对象的同一个方法的结果: public class TestSyn { public void showMsg() { try { for ...
- 解除IE锁定主页批处理
解除IE锁定主页.bat rem 解除IE锁定主页@echo offecho HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main [ ...
- java.util.ConcurrentModificationException的解决办法
今天在使用iterator.hasNext()操作迭代器的时候,当迭代的对象发生改变,比如插入了新数据,或者有数据被删除. 编译器报出了以下异常: Exception in thread " ...
- Lucene suggest [转]
The Big Data Zone is presented by Splunk, the maker of data analysis solutions such as Hunk, an an ...
- Socket调用Close后如何终止套接口的问题
setsockopt 设置 SO_LINGER 选项 此选项指定函数close对面向连接的协议如何操作(如TCP).内核缺省close操作是立即返回,如果有数据残留在套接口缓冲区中则系统将试着将这些数 ...
- 服务容错保护断路器Hystrix之二:Hystrix工作流程解析
一.总运行流程 当你发出请求后,hystrix是这么运行的 红圈 :Hystrix 命令执行失败,执行回退逻辑.也就是大家经常在文章中看到的“服务降级”. 绿圈 :四种情况会触发失败回退逻辑( fal ...
- UnicodeString基本操作(Ring0)
#include "Unicode_String_Ring0.h" //bp Unicode_String_Ring0!DriverEntry NTSTATUS DriverEnt ...
- PowerDesigner最基础的使用方法入门学习(二)
1. 生成sql脚本 Database→Generate Database 选择要输出的文件路径,即文件存储路径,并根据需要修改文件名,单击确定后便会生成sql脚本. 在Options选项卡里,可以 ...
- MFC 控件使用教程
combo box控件用法: 下拉选择控件,首先将控件拖动到你需要使用控件的地方,用ClassWizard为它关联一个变量,我们注意到变量类型是CString型的.右击属性,General中可以设置一 ...