If you’re a Java developer, you might have encountered the error “javac not recognized as an internal or external command” while trying to compile Java code from the command line.
This error occurs when Java is not properly installed or configured on your system.
Here is exact error :
'javac' is not recognized as an internal or external command, operable program or batch file
In this article, we’ll explore how to fix this issue.
Causes of the javac not recognized Error
The “javac not recognized as an internal or external command” error occurs when the Java Compiler (javac) is not recognized as a valid command on your system. This can happen for several reasons:
– Java is not installed on your system.
– The Java Development Kit (JDK) is not installed on your system.
– The PATH environment variable is not set correctly, preventing the system from finding the Java Compiler.
How to fix javac not recognized error
To fix the “javac not recognized as an internal or external command” error, you can try the following steps:
- Check if Java is Installed
The first step in fixing the error is to make sure that Java is installed on your system. To check if Java is installed, open a Command Prompt or Terminal window and enter the following command:
If Java is installed, you’ll see the version of Java displayed in the output. If Java is not installed, you’ll see an error message indicating that Java is not found.
- If Java is not installed on your system, the next step is to install the Java Development Kit (JDK). The JDK includes the Java Compiler (javac) and other tools required for developing Java applications. You can download the JDK from the Oracle website.
- If Java and the JDK are installed on your system, but you’re still encountering the “javac not recognized as an internal or external command” error, the problem might be with the PATH environment variable. The PATH environment variable tells your system where to look for executable files, including the Java Compiler.
Find the correct path where you installed the JDK. On windows, it looks like this: C:\Program Files\Java\jdkxxxx\bin\
- Start-menu search for “environment variable” to open the options dialog.
- Examine PATH. Remove old Java paths.
- Add the new Java path to PATH… Don’t replace the complete old path, just add the JDK bin path.
- Edit JAVA_HOME. If not present add a new JAVA_HOME variable with same JDK bin path.
- Close and re-open console/IDE.
© 2019 – 2023, https:. All rights reserved. On republishing this post, you must provide link to original post