Can't execute java files on command prompts when they work perfectly in Eclipse IDE, what to do?
- by Eduardo de Luna
I run the following code in Eclipse IDE:
public class HelloWorld {
public static void main(String[] args)
{
System.out.println("Hello World!" ) ;
}
}
And it renders the expected output.
When getting into the command prompt (DOS) already in the directory, I type this
javac HelloWorld.java
And then this
java HelloWorld
And the output reads
Exception in thread "main" java.lang.NoClassDefFoundError:
HelloWorld <wrong name:learning/HelloWorld>
With a whole lot more errors, learning being the name of my general package.
What's wrong? I have installed Eclipse x86 SDK 4.2.0 together bit with the latest JRE and JDK both in 64 bit as well.