Java throws the error, ‘javac’ is not recognized as an internal or external command, operable program or batch file, if the path of JDK is not set in environment variable.
According to Java documentation –
PATHenvironment variable is a series of directories separated by semicolons (;) and is not case-sensitive. Microsoft Windows looks for programs in the
PATHdirectories in order, from left to right.
You should only have one
bindirectory for a JDK in the path at a time. Those following the first instance are ignored.
To add JDK path to the environment variable, follow these instructions –
Check where JDK is installed in your system. The default location is –
Note: There are 2 things – JDK and JRE. javac is the part of JDK and not JRE. If you do not find a directory with name jdk in your Java installation path, then it means JDK is not installed correctly. You need to run installation again.
- Open Control Panel > System
- Click on Advanced > Environment Variables
binlocation (C:\Program Files\Java\jdk-15\bin) to the
Or, if you do not want to add path variable, you can still use javac using full path –
C:\> "C:\Program Files\Java\jdk-15\bin\javac" MyClass.java
This will solve your error of, javac not recognized as internal/external command.