程序很简单,大概是什么东西没配置好。
错误提示:
VM Started:
Exception occurred: java.lang.ClassNotFoundException (uncaught)"thread=main", java.net.URLClassLoader$1.run(), line=199 bci=72main[1]程序框中指向:
throw new ClassNotFoundException(name); 谢谢!
错误提示:
VM Started:
Exception occurred: java.lang.ClassNotFoundException (uncaught)"thread=main", java.net.URLClassLoader$1.run(), line=199 bci=72main[1]程序框中指向:
throw new ClassNotFoundException(name); 谢谢!
类没有找到
一般是classpath没有配好,常见的问题是少了一个点 .;
类没有找到
一般是classpath没有配好,常见的问题是少了一个点 .;
我用的是:j2sdk1.4.2_04版
环境变量设置为:
java_home: c:\j2sdk1.4.2_04
class_path: .;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar不知有没有错?
把代码贴出来
然后随便命名一下。
生成两个文件:
hhh.java
其中代码:
public class hhh {
public static void main(String[] args) {
// Create application frame.
HhhFrame frame = new hhhFrame();
// Show frame
frame.setVisible(true);
}
}
hhhfram.java
代码:
import java.awt.*;
import java.awt.event.*;/**
* Sample application using Frame.
*
* @author
* @version 1.00 06/02/17
*/
public class hhhFrame extends Frame {
/**
* The constructor.
*/
public hhhFrame() {
MenuBar menuBar = new MenuBar();
Menu menuFile = new Menu();
MenuItem menuFileExit = new MenuItem();
menuFile.setLabel("File");
menuFileExit.setLabel("Exit");
// Add action listener.for the menu button
menuFileExit.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
hhhFrame.this.windowClosed();
}
}
);
menuFile.add(menuFileExit);
menuBar.add(menuFile);
setTitle("hhh");
setMenuBar(menuBar);
setSize(new Dimension(400, 400));
// Add window listener.
this.addWindowListener
(
new WindowAdapter() {
public void windowClosing(WindowEvent e) {
hhhFrame.this.windowClosed();
}
}
);
}
/**
* Shutdown procedure when run as an application.
*/
protected void windowClosed() {
// TODO: Check if it is safe to close the application
// Exit application.
System.exit(0);
}
}编译过程中又出来一个URLClassloader.java 问题好像就出在这里。谢谢各位回复!
我是第一次上这个论坛,没想到大家这么热心!!
错误应该在这里.
把HhhFrame该为hhhFrame就可以通过了.我是在dos是做的测试.
错误应该在这里.
把HhhFrame该为hhhFrame就可以通过了.就是哈,类和构造方法的名字必须相同,区分大小写