Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

'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
add comment

3 Answers

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!

share|improve this answer
add comment

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
add comment

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

PATH=%PATH%;c:\Path_to_java\bin

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 "GrapesSwamptar.java" 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
    
hmmm....you 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 GrapesSwamptar.java is located 2. type C:\Documents and Settings\Admin\My Documents\ java\bin\javac GrapesSwamptar.java –  bryan Aug 3 '10 at 18:45
    
C:\Documents and Settings\Admin>cd C:\Documents and Settings\Admin\My Documents\ java\bin\javac GrapesSwampTar.java 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
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.