Eclipse错误:找不到或加载主类 [英] Eclipse Error: Could not find or load main class

查看:527
本文介绍了Eclipse错误:找不到或加载主类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

广泛关注此错误,但我似乎无法解决问题。我在Eclipse Juno中编写了一个基本的java程序,如下所示:

Have Googled extensively on this error, but I can't seem to fix the problem. I've written a basic java program in Eclipse Juno, as follows:

public class HelloWorld {

    /**
     * @param args
     */

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

}

点击运行后,我得到: 错误:找不到或加载主类HelloWorld。此错误消息适用于同一工作空间中的所有其他项目。我已经尝试切换工作区,但错误仍然出现。

After clicking Run, I get: "Error: Could not find or load main class HelloWorld". This error message applies to all my other projects in the same workspace. I've tried switching workspaces but the error still appears.

我在Windows 7 64位。任何帮助将不胜感激!

I'm on Windows 7 64-bit. Any help would be appreciated!

推荐答案

我刚遇到这个问题。原因...不确定。但是,只有在我添加了一个新的jvm之后才发生。
我的解决方案:

I just ran into that problem. The cause... not sure. However, only happened after I added a new jvm. My solution:


  • 运行配置: - run->运行配置

  • went to run configurations: - run->run configurations

在Classpath选项卡中:

In the Classpath tab:


  • 选择高级

  • 添加Eclipse通常将* .class放在项目的bin中。所以我添加了项目的bin目录。

我希望它可以帮助某人在那里。花了我一点时间才能确定出来。

I hope it helps someone out there. It took me time to figure this out.

这篇关于Eclipse错误:找不到或加载主类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆