1

I have downloaded the java JDK but I am unable to run the program. It is giving me an error like: javac is not recognized as an internal or external command.I have written the program " Hello.java and put it in the C directory.

Where I am doing the mistake? I am compiling it with: javac C:\hello.java

Do I need to give path location of my jdk version>?How do i do that? I have installed my Java in program files of C directory.

C:\>set PATH="%PATH%;C:\Program Files\Java\jdk1.6.0_22\bin"

C:\javac hello.java

I am still getting the error

4
  • You may need to manually add the path to your java compiler to your environment variables. How you have to do that slightly varies depending on what version of Windows you are using. Commented Nov 3, 2010 at 5:41
  • 1
    See How can I set the PATH variable for javac so I can manually compile my .java works?. Commented Nov 3, 2010 at 5:42
  • I am still getting the same error....plz check the updated part of my question Commented Nov 3, 2010 at 5:54
  • 1
    @shilps, why are you setting the value of PATH environment variable in double quotes? Your problem starts there. Commented Nov 3, 2010 at 6:04

2 Answers 2

1

You will have to first set the bin folder of Java installation in the PATH variable. After that you can try the command javac. You will get a list of help commands. You should be able to compile it.

commands:

javac hello.java

java hello

EDIT - Also, set the CLASSPATH variable.

e.g. set PATH=%PATH%;;

Sign up to request clarification or add additional context in comments.

Comments

1

If you're using windows, you need to set the path variable in the environment variables tab. Setting it inside the command prompt will cause the path setting to be lost after the window is closed.

So:

  1. Go to system / advanced tab / environment variables.
  2. Add javac's path to the PATH variable. Make sure the path is correct.
  3. Close and reopen all command prompts.

Have you tried ending the path with a backslash?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.