1

I am trying to compile some java code on Windows 7 pc, I have installed java JDK and I am trying to use the javac command in cmd but I get output saying that

'javac' is not recognized as an internal or external command, operable program or batch file.

What do I have to do to enable compiler in cmd or is it possible to do in Windows?

2
  • 4
    Either add the path where your javac executable resides to your %PATH% environment or use the absolute path to javac for executing it. Commented Feb 15, 2013 at 12:54
  • Related: stackoverflow.com/questions/7709041/… Commented Feb 15, 2013 at 12:58

4 Answers 4

1

1)Go to properties by right click on icon Computer , then navigate to Advanced System Settings.

2)Click Environment Variables.

3)Click on New , set Variable name as path and Variable path as the path of java jdk installation directory which could be something like this -

C:\Program Files\Java\jdk1.6.0_23\bin;

where C:** is the drive where JDK is installed and **Program Files\java is the directory where it resides.

look out for semi-colon(;) at the last.

4)Click ok

5)Restart cmd and run javac , it should work now.

Look for Screenshots here for more help.

Regards

Anshul

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

4 Comments

Why is this not added through installation of JDK?
Did it work..?? , i dont know why it didnt happened , may be Oracle guys are lazy enough to code that , there was a time when JAVA used be under SUN , and it was shining , but now Oracle has ruined the rep of JAVA :/
Yes It worked and since this looks like be best answer I will accept it
Thank You :) happy java coding !!
0

you have to set a new system variable for your JAVA_HOME in windows.
See here for further information.

Comments

0

Add the path to bin folder of JDK in your PATH variable. For instructions to set PATH variable follow this tutorial.

Comments

0

Your java directory is not on the path. Here are some helpful screenshots to show how to set it up: http://vietpad.sourceforge.net/javaonwindows.html

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.