代码如下:
import java.awt.*class JavaGUI
{
private Frame myFrame;public JavaGUI() { myFrame = new Frame(); myFrame.setSize(400,400); myFrame.setTitle("The first java GUI application"); myFrame.setVisible(ture); } public static void main(String args[]) { System.out.println("Start JavaGUI..."); JavaGUI mainFrame = new JavaGUI(); }
}
错误提示如下
引用
Exception in thread "main" java.lang.NoClassDefFoundError: JavaGUI/java
Caused by: java.lang.ClassNotFoundException: JavaGUI.java
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)
Could not find the main class: JavaGUI.java. Program will exit.
Caused by: java.lang.ClassNotFoundException: JavaGUI.java
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)
Could not find the main class: JavaGUI.java. Program will exit.
问题补充
我现在弄明白了!