Sometimes , inspite of setting proper classpath for JAVA_HOME, getting this Error on running
$java filename(without exten) – Producing error means something strange. I too got irritated and finally found that its bcz its not considering the present working directory.
So by doing this
$java -classpath . filename
problem was solved
Here is the Great Hepful Link