Eclipse:找不到主类java.lang.NoClassDefFoundError:

时间:2013-05-13 10:15:28

标签: eclipse noclassdeffounderror

我在Eclipse中创建了一个Java类,当我想要运行该类时,我遇到了一个错误:无法找到主类:NamaofTheClass

控制台中的文字:

java.lang.NoClassDefFoundError: Kolko
Caused by: java.lang.ClassNotFoundException: Kolko
    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)
Exception in thread "main" 

代码:

public class Kolko
{
    private double promień;

    public Kolko()
    {
        this(1.0);
    }

    public Kolko(double r)
    {
        promień = r;
    }

    public double obliczObwód()
    {
        return 2*3.14*promień;
    }

    public double obliczPole()
    {
        return 3.14*promień*promień;
    }

    public String toString()
    {
        return "Wydruk";
    }


    public static void main(String[] args)
    {
        Kolko koło = new Kolko();
        System.out.println(koło);

    }
}

请你给我任何建议吗?

0 个答案:

没有答案