Eclipse下SWT/JFace的運(yùn)行問題解決
最近一直再用SWT/JFace做PIMS的項(xiàng)目,本以為已經(jīng)比較了解這個(gè)平臺(tái)了,而且也比較喜歡,直到從SWT跳到JFace開發(fā)時(shí)才碰到問題,就是怎么也運(yùn)行不了,錯(cuò)誤如下:
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.
很奇怪的是我明明已經(jīng)org.eclipse.core.runtime,于是就去包里直接找IPogressMonitor,發(fā)現(xiàn)果然沒有這個(gè)類,雖然 所有的書中都沒有寫要導(dǎo)入其他的什么包。這個(gè)問題一直困擾了我兩個(gè)晚上,我一狠心就直接去eclipse/plugin里面找 IPogressMonitor,卻在org.eclipse.equinox.common包中找到了這個(gè)class,真是不知道eclipse是什么 用心,好好的一個(gè)工程卻放在兩個(gè)包里,搞的我完全不知所以然。CSDN上有人 解釋說org/eclipse/core/runtime這個(gè)包不是封裝在一個(gè)jar包之下的,他們是屬于兩個(gè)項(xiàng)目的。
所以要想成用運(yùn)行SWT/JFace程序必須從eclipse/plugin里面導(dǎo)入以下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
還發(fā)現(xiàn)一個(gè)比較好的網(wǎng)站:http://www.findjar.com/index.x
大家遇到找不到JAR文件的時(shí)候可以去這里找找。
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.
很奇怪的是我明明已經(jīng)org.eclipse.core.runtime,于是就去包里直接找IPogressMonitor,發(fā)現(xiàn)果然沒有這個(gè)類,雖然 所有的書中都沒有寫要導(dǎo)入其他的什么包。這個(gè)問題一直困擾了我兩個(gè)晚上,我一狠心就直接去eclipse/plugin里面找 IPogressMonitor,卻在org.eclipse.equinox.common包中找到了這個(gè)class,真是不知道eclipse是什么 用心,好好的一個(gè)工程卻放在兩個(gè)包里,搞的我完全不知所以然。CSDN上有人 解釋說org/eclipse/core/runtime這個(gè)包不是封裝在一個(gè)jar包之下的,他們是屬于兩個(gè)項(xiàng)目的。
所以要想成用運(yùn)行SWT/JFace程序必須從eclipse/plugin里面導(dǎo)入以下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
還發(fā)現(xiàn)一個(gè)比較好的網(wǎng)站:http://www.findjar.com/index.x
大家遇到找不到JAR文件的時(shí)候可以去這里找找。
posted on 2009-12-24 14:59 Cabinw 閱讀(1349) 評(píng)論(0) 編輯 收藏 所屬分類: Eclipse