swt程序运行错误:“java.lang.NoClassDefFoundError”

kiss_wn 2007-06-24 12:28:54
我新建了一个windows application,运行时总是报错说:“java.lang.NoClassDefFoundError”,还弹出一个窗口说:“could not find the main class ,program will exit”


以下是源代码
package com.swtdesigner;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class HelloWorld {

private static Text text;
/**
* Launch the application
* @param args
*/
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell();
shell.setSize(500, 375);
shell.setText("SWT Application");
//

shell.open();

text = new Text(shell, SWT.BORDER);
text.setBounds(152, 135, 80, 25);
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}

}
...全文
295 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhuokai 2007-06-24
  • 打赏
  • 举报
回复
经测试,正常显示。。。
去掉包结构看看,这个com.swtdesigner好像和swtdesigner同包名

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧