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

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

问题描述

我在Eclipse 4.2中运行一个项目时遇到麻烦。我有一个Java程序,一个类称为转换。 Eclipse构建项目很好。我可以通过在工作区中的项目文件夹中导航到/ bin /,然后输入 java Conversion

$ b,从命令行运行程序。
$ b

但是,当我尝试从Eclipse运行程序时,我显示错误:在控制台中找不到或加载主类转换



项目名称为 10.12.12:Project

解决方案

Eclipse不支持在项目名称中使用冒号或连字号。冒号似乎打破了处理编译的方式。



可以通过在项目的名称中不使用冒号来解决问题。



如注释中所述,这可能是Java 6的一个错误。它在Java 7中已修复。


I'm having trouble running a project in Eclipse 4.2. I have a Java program with one class titled Conversion. Eclipse builds the project fine. I'm able to run the program from the command line by navigating to /bin/ in the project's folder that's in the workspace and typing java Conversion.

However, when I try to run the program from Eclipse, I am shown Error: Could not find or load main class Conversion in the console.

The project name is 10.12.12: Project.

解决方案

Eclipse does not support the use of a colon or hyphen in project names. Colons appear to break the way it handles compilation.

The issue can be fixed by not using a colon in the project's name.

As noted in the comments, this may be a fault of Java 6. It is fixed in Java 7.

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

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