错误:在Eclipse中找不到或加载主类 [英] Error: Could not find or load main class in Eclipse
问题描述
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屋!