Table of Contents
In this article, we will see how to solve java is not recognized as an internal or external command error. If you are working with java then probably you have fair idea about the error as this error is so common that there is also a possibility that you might get this error in your System at any point of time due to certain reasons. The same thing happened to me when I ran
java --version command to check the java version installed in my system. I received
"java is not recognized as an internal or external command" error on the output which I was certainly not expecting.
But after checking this error, I understood the problem and then decided to write an article about this mentioning all the possible scenarios which could cause this error so that it will help you guys as well. So without further delay let's begin !!
Solved "java is not recognized as an internal or external command"
When I tried to check the java version installed in my system, it displayed
"java is not recognized as an internal or external command" error on the output as shown below.
C:\Users\cyberithub>java --version 'java' is not recognized as an internal or external command, operable program or batch file.
While the above error could occur due to many reasons but most of the time it is due to either java is not installed in your System or it is installed in some different path which is not visible to the System. So depending on the situation you have you can try to follow below solutions.
Solution 1: Install Java
If you don't have java installed in your system then you need to follow below steps to download and install java in a Windows 64-bit system.
Step 1: Download JDK
Go to Oracle official website and download the latest JDK exe file from below link.
Once it starts downloading, you can track the progress as shown below.
Step 2: Install JDK
After successfully downloading the JDK software, you need to double click on it to start the Installation. You should see below Installation Wizard. Click on
Next to continue.
If you want, you can change the installation folder by clicking on
Change and browse to the location where you want to install the Java Development Kit. Otherwise, you can use the default location and click on
Next to continue.
The installation will start and progress as shown below.
Once done, you will see below
Successfully Installed message. You can close the wizard by clicking on
After successful installation, you need to close your currently opened command prompt and then start it again. Then run
java --version command to verify the successful installation of JDK. You should see an output like below.
C:\Users\cyberithub>java --version java 19.0.1 2022-10-18 Java(TM) SE Runtime Environment (build 19.0.1+10-21) Java HotSpot(TM) 64-Bit Server VM (build 19.0.1+10-21, mixed mode, sharing)
This confirms that JDK is successfully installed in your System and now you can use the java utility.
Solution 2: Set PATH environment variable
Sometimes it is possible that you might have Java already installed in your System but still you are getting
"java is not recognized as an internal or external command" error. It is simply because the installation path is not visible to the system. So to solve this problem you can either set
PATH environment variable in your System. To do that, follow below steps.
Ctrl+Rto open Run
"rundll32.exe sysdm.cpl,EditEnvironmentVariables"and press enter.
- Set your environment variable.
- Then click on
OKto save and close.
Solution 3: Provide Permission
In few of the cases, it is also possible that java is installed properly and the path is also set correctly but still you are facing
"java is not recognized as an internal or external command" error. Another possible reason is that you don't have enough permission to access the installation path where java is installed and hence system is not allowing you to detect and run the program. In this case, you need to check your user permissions and make sure you have all the permission in place to access the tools.
Solution 4: Reinstall JDK
Finally, there are some situations where everything is fine and you don't see any reason for
"java is not recognized as an internal or external command" error. In those case, I would suggest you to follow below steps:-
- Uninstall existing JDK software.
- Cleanup all the temporary files.
- Restart your System.
- Then finally install the JDK software again by following solution 1 as mentioned above.
Hope above solutions should be enough to solve your
"java is not recognized as an internal or external command" error. Please let me know your feedback in the comment box !!