Skip to Main Content

Trouble using Java from DOS command line

1053546Nov 10 2013 — edited Nov 10 2013


When I try to run Java from the Windows DOS command line, I'm running into trouble:

1. When I run Java from the wrong directory, I get the error Error: cannot find or load main class myapp1.

2. When I get to the "right" directory (.../MyApp1/build/classes/myapp1/, which is where the MyApp1.class file resides), I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: MyApp1 (wrong name: myapp1/MyApp1)

1. The CLASSPATH variable is not set (when I type echo %CLASSPATH% the system returns %CLASSPATH%).

2. I also get the same error above when I use: > java -cp . myapp1

(3. I've made sure the PATH is set correctly in environment variables, with the Java path at the beginning of the path string).

Does anyone have any ideas?

Many thanks in advance for any tips or guidance!

Best regards,


This post has been answered by baftos on Nov 10 2013
Jump to Answer
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Dec 8 2013
Added on Nov 10 2013