Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

'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?

share|improve this question
what OS do you use? – akira Oct 11 '10 at 8:42

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" (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 (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 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!

share|improve this answer

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.

share|improve this answer
windows xp is what i am using would it be goo to change to eclipse to have a compiler, would that be easier or just a waste of time? – user45021 Aug 3 '10 at 18:35
you mean to put the bin folder into my java folder? – user45021 Aug 3 '10 at 18:42
@plring - it is a good idea to learn how to compile java apps from the commandline, it's always a good idea to know what your ide (eclipse) is doing for you. – Millhouse Aug 3 '10 at 20:10

The javac executable is probably not in your PATH variable.

Try typing c:\full_path_to_java\bin\javac whatever.class assuming your using windows.

If that works you need to add the java bin to your PATH

To add the java bin directory to your PATH do the following from a command prompt


That's assuming that you installed java on the c drive.

To make this permanent add the java\bin path to

System Properties ->  Advanced -> Environment Variable -> System Variables - Path
share|improve this answer
Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\Admin>cd C:\Documents and Settings\Admin\My Documents\ java\bin\javac "" The system cannot find the path specified. this is what i get, what am i doing wrong? please help. – user45021 Aug 3 '10 at 18:38 have a cd command and a path with a file name in it and a java file to compile. That's just not right. – bryan Aug 3 '10 at 18:43
If you're sure you installed java to your My Documents directory you could try the following - 1. change to the directory where is located 2. type C:\Documents and Settings\Admin\My Documents\ java\bin\javac – bryan Aug 3 '10 at 18:45
C:\Documents and Settings\Admin>cd C:\Documents and Settings\Admin\My Documents\ java\bin\javac The system cannot find the path specified. C:\Documents and Settings\Admin> oh boy, i know i seem real stupid please help. – user45021 Aug 3 '10 at 18:49
would it be easier if i tried to download and use NetBeans IDE to convert a .java script to a .class script (file)?? – user45021 Aug 3 '10 at 18:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .