I am trying to compile a java program I found on the internet and it says that I must check if javac is installed. I installed the JDK a long time ago so it should be working but I get command not found error:

alt text

how can this be resolved?

3 Answers 3


It looks like the javac executable cannot be found because you did not set your PATH environment variable to include it. This is a simple fix.

Since you are clearly using Windows XP...

  • Right click "My Computer" and select "Properties". (or Win + Pause)
  • Go to the "Advanced" Tab
  • Click the "Environment Variables" button near the bottom of the dialog
  • Under "User variables" for your account, there should be a PATH variable, if there is not click "New" and create it with the variable name PATH and the value as the path to your jdk's bin directory (something like C:\Program Files\Java\jdk1.6.0\bin, it is different between installations so you will have to check C:\Program Files\Java for a jdk version). If it already exists but is empty, change it to the path to your jdk's bin directory. If it already exists but is NOT empty, append a semicolon (;) along with the path to your jdk's bin directory.

The value should look like this:

alt text

If there were previous values, it should be separated with a semicolon like so:

alt text


First check if you still have the java compiler on your computer.

Open a command prompt and type

cd \

dir javac* /s

If it didn't find any files, install the JDK to compile your java program.


You need to edit the environment variables, as mentioned by John T. The built in windows environment variable editor is kind of a pain, check out Rapid Environment Editor.


  • Looks more complicated, but maybe that's just me O_o
    – user1931
    Commented Jul 25, 2009 at 21:47
  • Have fun editing a paragraph long PATH variable on one line with the built in editor. This editor splits that all up for you into manageable chucks. Commented Jul 25, 2009 at 23:41
  • if you're path variable is that long you're doing something wrong
    – user1931
    Commented Jul 26, 2009 at 4:25
  • 3
    Or just lots of development tools all wanting in on the PATH.
    – KTC
    Commented Jul 26, 2009 at 4:39

You must log in to answer this question.