Frame问题
import java.awt.*;
class VonKoch extends Frame {
int size;
Point currPt,pt=new Point();
int angle=0;
int level;
VonKoch(int x,int y,int size,int level){
super("VonKoch");
currPt=new Point(x,y);
this.size=size;
this.level=level;
setSize(200,200);
setBackground( Color.red );
setForeground(Color.white);
setVisible(true);
}
public static void main(String[] args){
VonKoch p=new VonKoch(100,200,2,4);
}
}
能编译但不能远行 哪位高手能帮帮我吗?
搜索更多相关的解决方案:
Frame
----------------解决方案--------------------------------------------------------
我晕 能运行!~
----------------解决方案--------------------------------------------------------
E:\java>java Vonkoch
Exception in thread "main" java.lang.NoClassDefFoundError: Vonkoch (wrong name:
VonKoch)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
那这是什么意思啊?
----------------解决方案--------------------------------------------------------
可以运行的,文件名要改成VonKoch.java
注意下你的文件名是Vonkoch
----------------解决方案--------------------------------------------------------