当前位置: 技术问答>java相关
高手救命!!!,我所有的程序都抱一个错"Can't find main class"。。不知是哪里出毛病了。
来源: 互联网 发布时间:2015-09-10
本文导语: 以前都是好好的程序,今天却都抱错了,以前绝对是好的,当然都有main() 对话框 Java Virtual Machine launcher "Can't find main class,Program will exit", 写了个最简单的程序也同样。 然后是;java.lang.NoClassDefFoundError...
以前都是好好的程序,今天却都抱错了,以前绝对是好的,当然都有main()
对话框
Java Virtual Machine launcher
"Can't find main class,Program will exit",
写了个最简单的程序也同样。
然后是;java.lang.NoClassDefFoundError:
Exception in thread "main"
请问高手,这是什么原因造成的???
我装的是JDK1.4.0,
对话框
Java Virtual Machine launcher
"Can't find main class,Program will exit",
写了个最简单的程序也同样。
然后是;java.lang.NoClassDefFoundError:
Exception in thread "main"
请问高手,这是什么原因造成的???
我装的是JDK1.4.0,
|
classpath设置错误
改为:.;c:jbuilder6jdk1.3.1libdt.jar;c:jbuilder6jdk1.3.1libtools.jar;c:jbuilder6jdk1.3.1libdt.jar;c:jbuilder6jdk1.3.1jrelib
改为:.;c:jbuilder6jdk1.3.1libdt.jar;c:jbuilder6jdk1.3.1libtools.jar;c:jbuilder6jdk1.3.1libdt.jar;c:jbuilder6jdk1.3.1jrelib
|
java class path错误,将这个设置到你的工作目录
|
把你的程序(.class)加入当前的classpath
|
public static void main(String[] args) {
Applet1 applet = new Applet1();
applet.isStandalone = true;
Frame frame;
frame = new Frame() {
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
public synchronized void setTitle(String title) {
super.setTitle(title);
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
}
};
frame.setTitle("程序示例");
frame.setResizable(false);
frame.add(applet, BorderLayout.CENTER);
applet.init();
applet.start();
frame.setSize(540,480);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
frame.setVisible(true);
}
Applet1 applet = new Applet1();
applet.isStandalone = true;
Frame frame;
frame = new Frame() {
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
public synchronized void setTitle(String title) {
super.setTitle(title);
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
}
};
frame.setTitle("程序示例");
frame.setResizable(false);
frame.add(applet, BorderLayout.CENTER);
applet.init();
applet.start();
frame.setSize(540,480);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
frame.setVisible(true);
}
|
是不是打包了?
如果是 要在报外面编译、执行
如果是 要在报外面编译、执行
|
是不是path 被清了
|
要指定你的web 服务器吧