[英]Eclipse cannot find the main class in JFace?
I'm working though a book SWT/JFace IN ACTION by Manning Press. 我正在读一本Manning Press的SWT / JFace IN ACTION书。
When I added JFace, Eclipse for some reason could not find the main class though it is plainly present. 当我添加JFace时,由于某种原因,Eclipse尽管找到了主类,却找不到主类。
Here is the code 这是代码
package com.swtjface.ChTwo;
import org.eclipse.jface.window.*;
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
public class HelloSWT_JFace extends ApplicationWindow{
/**
* @param args
*/
public HelloSWT_JFace(){
super(null);
}
protected Control createContents(Composite parent){
Text helloText = new Text(parent, SWT.CENTER);
helloText.setText("Hello SWT and JFace!");
parent.pack();
return parent;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
HelloSWT_JFace awin = new HelloSWT_JFace();
awin.setBlockOnOpen(true);
awin.open();
Display.getCurrent().dispose();
}
}
The reject message I get from Eclipse is... 我从Eclipse收到的拒绝消息是...
Could not find the main class: com.swtjface.ChTwo.HelloSWT_JFace.
Program will exit.
Here is the exception... 这是例外...
java.lang.NoClassDefFoundError: org/eclipse/core/runtime/IProgressMonitor
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.IProgressMonitor
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Exception in thread "main"
You need at least 2 more jars to use JFace: 您至少还需要2个jar才能使用JFace:
See Using JFace outside the Eclipse platform for more details. 有关更多详细信息,请参见在Eclipse平台之外使用JFace 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.