在Eclipse中找不到或加载Mainclass

时间:2014-07-06 10:32:32

标签: java eclipse

我已经通过Git导入了JavaProject。在下一步中,我想测试一个简单的Hello-World-Programm。

public class Test {

    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

如果我在Package-Explorer中右键单击Test.java并执行“Run - as Java-Application”,它会说:

Fehler:Hauptklasse Test konnte nicht gefunden oder geladen werden [错误:无法找到或加载主类测试。

是否有类似Ant的东西可以干扰简单的运行命令?

在另一个项目中,一切正常,使用我的Java-JDK。

2 个答案:

答案 0 :(得分:0)

编辑是否使用' javac'导致类文件?你检查了吗?还要确保您在发布' java'的目录中拥有该类文件。命令。

答案 1 :(得分:0)

this problem really killed me as well and by chance I just discovered what was the problem with my project:

Eclipse throws this error message when the project name has illegal characters like ":". Deleting those has solved the problem for me.