Error: Could not find or load main class HelloWorld

So you just downloaded the ubiquitous Java HelloWorld and you run java HelloWord after you compile it of course with “javac HelloWorld.java” and you are presented with this error message :

Error: Could not find or load main class HelloWorld

Cause: Apparently the folder that you are running the java application from, needs to be in your CLASSPATH (does not quite make sense) but i will be looking for a better explanation.

SOLUTION #1

Add ":." to your CLASSPATH (Dont use the double quotes)

Or

SOLUTION #2

java -cp . HelloWorld

Remeber the dot(.) refers to the current directory.