javac not recognized..?

'javac' is not recognized as an internal or external command, operable program or batch file ok i have the jdk1.6.0_21 installed on my pc, but when i try to use the command promt to convert a .java script to a .class script i get the above error msg. can someone help me here please?


When you install a program (here: javac.exe), you can start that program in two ways:

  • Type the full path: "C:\Program Files\Java 1.X.Y\bin\javac" MyStuff.java (note the quotation marks; they are needed because of the spaces in the path name)
  • Change into the directory, then issue the command: cd "C:\Program Files\Java 1.X.Y\bin\", then javac MyStuff.java (only if the file is in the same directory)

The solution to this is setting the PATH variable. It holds a ; seperated list of folders, where your executable files live. Set it like this for one time change: set PATH="%PATH%;C:\Program Files\Java 1.X.Y\bin". Now you can issue the command javac MyStuff.java in the folder with your source, or from any other folder, without typing the whole path every time.

See other post for setting this permanently. Hope you enjoy coding!


You will need to use the full path of javac or but the bin folder of your JDK in your environment path.

Cannot give any specific details without knowing your platform.