I want to run a java file in windows command prompt instead of the IDE. I have a file named Names.java and compiling with javac Names.java
works fine. Nevertheless, after compiling this file, I get an Error when I want to run that file withjava Names
. This ist the Error:
Error: Could not find or load main class Names
Caused by: java.lang.NoClassDefFoundError: myFiles/Names (wrong name: Names)
(FYI: myFiles is the name of my package I created in Eclipse)
Bizarrely, it works fine if I run the .java-file with java Names.java
, but I need to run the compiled .class-file.