Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

Cannot compile Java Class.



I have installed java into D:/Program Files/Java
I opened the command prompt.Reached C:\.
I have a Test.java file in C:\.
Now when i run the command javac Test.java , it throws and error saying javac not found.

I copied the same Test.java to D:\.
In the cmd prompt i set the current directory as D:\.
Now i ran the cmd javac Test.java, it worked.

May i know the reason for getting this error in the first scenerio.
I couldnt understand the reason why it happened.