Take the 2-minute tour ×

I'm trying to compile and run java file using the command line, but it's not working. I've followed the steps on http://introcs.cs.princeton.edu/java/15inout/windows-cmd.html, using the correct file path and a current jdk and I still get javac is not recognized when typing javac -version. What am I doing wrong?

share|improve this question
Please paste the full jdk\bin present in your PATH –  basiljames Oct 5 '12 at 5:18
C:\Program Files (x86)\Java\jdk1.7.0_07\bin; javac works now, but when trying to run my simple java file by entering java test I get Exception in thread "main" java.lang.UnsupportedClassVersionError –  Alwaysdeadfred Oct 5 '12 at 19:16

2 Answers 2

You need to add the folder where javac exists to your PATH. It might not be the same path specified in the given link.

share|improve this answer
close cmd and start again, the path is not refreshed for an already opened session –  MByD Oct 5 '12 at 4:57
It was closed when I updated the path. –  Alwaysdeadfred Oct 5 '12 at 4:58

Please follow this link to set PATH and CLASSPATH for java in windows

share|improve this answer

Your Answer


