java is not recognized as an internal or external command - How to Fix it

Originally published on 10/22/2022
Java on Windows

How to fix java is not found on your windows installation

To run java programs and/or develop java apps your windows must know how to find it. Sometimes even if you havae installed yjava on your windows machine, windows doesnt know how to find it so you must set some System Variables. It's easy just follow along

1- Make sure you have java installed

To run java apps you must have java installed on your machine duh! Yeah just make sure you have it and find the path to it, normally is in C:\Program Files\Java\jdk-XXX or C:\Program Files\Java\jreXXX where the XXX is your current version. if you dont have java installed you need to install it first just go to oracle's webpage If you not developping java apps you only need the JRE version otherwise get the latest JDK.

2- Setting windows Environment variables

Having done all of the above just follow the next steps to get your java ready.

1 - First open your search bar and type "Edit the system environment variables" as you start typing it will appear as first.

2 - Click it than click in the button "Environment Variables..."

Windows properties windows.

3- Add the JAVA_HOME variable

This variable is used for programs know where java is installed on your Windows system

JAVA_HOME system properties windows.

4 - Add JAVA_HOME to system path

So windows can pick it up

JAVA_HOME system properties windows.

5 - Confirm that java is in path

By now you Windows system should be able to find your java instalation. To confirm just open a new comand prompt by pressing Windows Key + R on your keyboard, then type the following command:

java -version
Checking your java version
If you had a cmd window oppened before please close it up and reopen it again or that window will have the old system variables!

Conclusion

Now you have java installed and findable on your system. If not please make sure that you have everything setup up correctly and reboot your machine if needed.

Have a nice day.

HomePrivacy policy