I have added Path variable 'C:\Program Files\Java\jdk1.6.0_21\bin'
in Environment Variables, but it still gives me this error: 'javac' is not recognized as an internal or external command, operable program or batch file
when I try to run javac mycode.java
. I am going insane, please help. Thanks.
views:
105answers:
1
+4
A:
Close the command prompt window and open it again so that the new environment variables take effect.
Leniel Macaferi
2010-09-05 22:47:58
Of course this step was mentioned in the instructions I linked to the original question. Wonder if he ever read them...
Carlos
2010-09-05 22:51:06
Now I tried to change .java file's directory and it works. But it gives me an error: `C:\Users\Tomas>javac hello.javahello.java:1: class my_first is public, should be declared in a file named my_first.javapublic class my_first`
hey
2010-09-05 22:53:47
Rename your .java file to my_first.java and try compiling again. The source code file must have the same name of your class, in this case, my_first.
Leniel Macaferi
2010-09-05 22:54:54
The error message tells you exactly what is wrong. The name of the file must match the name of the class. Rename hello.java to my_first.java and it should work.
Carlos
2010-09-05 22:56:32
It fuc*king works now! Yahoooo!
hey
2010-09-05 22:56:35