I am facing this problem while trying to run my java file by writing java filename ….
I have read on many pages the possible ways this could be corrected but unfortunately I have been unable to correct my problem…
-
First of all I looked at my environment variables and observed that there was no CLASSPATH set and I had pointed PATH correctly to my jre as well as jdk bin in C:\
-
Second I am able to run javac filename.java and observe that .class file gets built in the local directory.
-
While writing javac -classpath . filename works writing java -classpath . filename (without .class) results in the same error.
I just don’t know how to run my program in command prompt!!!!
Please do not give me links to the pages which have given the same answers that I have mentioned above as they do not work in my case…..
Please help….
Note that if your class resides in some package
mypackage, you need to make sure the class file is insidemypackage/and do