Eclipse下SWT/JFace的运行问题解决

最近一直再用SWT/JFace做PIMS的项目,本以为已经比较了解这个平台了,而且也比较喜欢,直到从SWT跳到JFace开发时才碰到问题,就是怎么也运行不了,错误如下:

Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/runtime/IProgressMonitor
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.IProgressMonitor
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: com.jface.applicationwindow.HelloJFace.  Program will exit.

很奇怪的是我明明已经org.eclipse.core.runtime,于是就去包里直接找IPogressMonitor,发现果然没有这个类,虽然 所有的书中都没有写要导入其他的什么包。这个问题一直困扰了我两个晚上,我一狠心就直接去eclipse/plugin里面找 IPogressMonitor,却在org.eclipse.equinox.common包中找到了这个class,真是不知道eclipse是什么 用心,好好的一个工程却放在两个包里,搞的我完全不知所以然。CSDN上有人 解释说org/eclipse/core/runtime这个包不是封装在一个jar包之下的,他们是属于两个项目的。
所以要想成用运行SWT/JFace程序必须从eclipse/plugin里面导入以下Jar文件:

org.eclipse.jface.text_3.5.1.r351_v20090708-0800.jar
org.eclipse.jface_3.5.1.M20090826-0800.jar
org.eclipse.core.runtime_3.5.0.v20090525.jar
org.eclipse.core.runtime.compatibility_3.2.0.v20090413.jar
org.eclipse.osgi_3.5.1.R35x_v20090827.jar
org.eclipse.core.commands_3.5.0.I20090525-2000.jar
org.eclipse.swt.gtk.linux.x86_3.5.1.v3555a.jar
org.eclipse.core.runtime.compatibility.auth_3.2.100.v20090413.jar
org.eclipse.equinox.common_3.5.1.R35x_v20090807-1100.jar

还发现一个比较好的网站:http://www.findjar.com/index.x
大家遇到找不到JAR文件的时候可以去这里找找。

posted on 2009-12-24 14:59 Cabinw 阅读(1336) 评论(0)  编辑  收藏 所属分类: Eclipse


只有注册用户登录后才能发表评论。


网站导航:
 

导航

<2009年12月>
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

统计

常用链接

留言簿

随笔分类

随笔档案

相册

搜索

最新评论

阅读排行榜

评论排行榜