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?

user207421
  • 305,947
  • 44
  • 307
  • 483
LegendaryLaggy
  • 455
  • 1
  • 6
  • 16
  • 4
    Either add the path where your `javac` executable resides to your `%PATH%` environment or use the absolute path to `javac` for executing it. – Dominik Sandjaja Feb 15 '13 at 12:54
  • Related: http://stackoverflow.com/questions/7709041/javac-is-not-recognized-as-an-internal-or-external-command-operable-program-or – user000001 Feb 15 '13 at 12:58

4 Answers4

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

anshulkatta
  • 2,044
  • 22
  • 30
0

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

Obl Tobl
  • 5,604
  • 8
  • 41
  • 65
0

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

kaysush
  • 4,797
  • 3
  • 27
  • 47
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

Jens Hoffmann
  • 6,699
  • 2
  • 25
  • 31