In this post we will discuss about Javac is not recognized by internal or external command. This is frequently raised error when JDK installation folder is not added to PATH environment variable. We will also discuss how to fix it.
when you try to compile a Java source file using javac command e.g. javac Helloworld.java but your PATH is not set properly.It means that javac.exe executable
file, which exists in bin directory of JDK installation folder is not added to PATH environment variable.
- You need to add JAVA_HOME/bin folder in your machine's PATH to solve this error.
- You cannot compile and run Java program until your add Java into your system's PATH variable.
- Here is how this error looks like in command prompt of windows as follows
Steps to fix 'javac' is not recognized as an internal or external command :
- Open command prompt in Windows by clicking Start button and then typing cmd on run window
- Type echo %PATH%, it will now show you all the directories which are available in PATH environment variable.
- Now copy this PATH output into your text editor e.g. Notepad or Word-pad and search if it contains the JDK installation directory or JAVA_HOME.
- For example, if your JDK is installed on "c:\program files\java\jdk1.8.0", then PATH should include "c:\program files\java\jdk1.8.0\bin".
- Sometime you will also see like %JAVA_HOME%\bin , where JAVA_HOME is another user defined environment which points to Java installation directory.
- If PATH doesn't contain bin directory of JDK, then you can add them into PATH by following command
- set PATH = %PATH%;"c:\program files\java\jdk1.8.0\bin
- Don't forget to close the current command prompt and open a new one before running the javac command again. Any change in environment variable is only available to new cmd windows.
- That's all about how to fix 'javac' is not recognized as an internal or external command, operable program or batch file error in Windows
No comments:
Post a Comment