+ 2
How to fix "Could not find or load main class. " problem in Eclipse Java 2012.
Hi. I installed Oracle JDK already before I installed Eclipse Indigo 2012 for Java. But it doesn't run my first Hello World program. I googled and I found it as path problem. But I can't find how to fix it yet. I use Window 7. Thanks in advance.
9 Respuestas
+ 3
Few important things. Your filename should be exactly the same, with the same capitalization, as the class in your program which contains the main method. Eg:
HelloWorld.java
public class HelloWorld {
Then I suggest to check if you can compile your program from command line. Open shell, switch to the directory where your java source file is, and try:
javac HelloWorld.java
If it does not work, it might be a path problem. If it works then I think it can be an issue with Eclipse setup.
+ 3
Are you able to compile and run the program from the command line? (without using Eclipse)
Do you get the same error?
You can check the Classpath setup in Eclipse too, maybe it helps
https://www.techwalla.com/articles/how-to-set-the-classpath-in-eclipse
+ 3
I am pretty sure it is an Eclipse setup issue, then. I use a different IDE so can't test. If this does not help, try googling 'eclipse classpath' to find more resources...
http://javahowto.blogspot.com/2006/06/set-classpath-in-eclipse-and-netbeans.html?m=1
+ 2
I could do it well in command line. error just happened in eclipse.
+ 1
Yes, it is a path problem. How can I fix it?
+ 1
Thanks. But I already did that too. Still it can't find yet.
+ 1
Tibor Santa: I can't see the pics in the link clearly
+ 1
Thanks, Tibor Santa