In order to use javac
in cmd
, JDK (Java Development Kit) must be installed on your system.
javac.exe
is inside JDK's bin
folder (e.g.: C:\Program Files\Java\jdk1.7.0_45\bin
), and NOT in JRE's bin folder (C:\Program Files\Java\jre7\bin
), because JRE is just a runtime environment (but you need the development kit to be able to compile source code).
You should append JDK's bin directory (C:\Program Files\Java\jdk1.7.0_45\bin
) to the PATH system environment variable.
If you don't have JDK, please download it from the following link:
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Reference thread for JDK vs. JRE:
What is the difference between JDK and JRE?
Procedure:
- Install JDK
- open command prompt
- type "
cd C:\Program Files\Java\jdk1.7.0_45\bin
", press Enter (path may change based on JDK version and 32-bit/64-bit OS version)
- type "
javac
", press Enter
Done.