Resolve ERROR: JAVA_HOME is not set and no ‘java’ command could be found in your PATH. On Windows.

Tiempo de lectura: 2 minutos

html
Copy code
Reading Time: 2 minutes

Hello, today we are going to see how we can solve the error: “ERROR: JAVA_HOME is not set and no ‘java’ command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.”

What is happening is that we do not have the JAVA_HOME variable added to our Windows environment variables list.

To add it, first, we need to make sure we have Java installed.

To do that, we install the Java version we need. To do this, we go to the website and download it. In my case, we are going to install OPEN JDK: https://learn.microsoft.com/es-es/java/openjdk/download

Or on the official OpenJDK website: https://openjdk.org/

Reading Time: 2 minutes

Hello, today we are going to see how we can solve the error: “ERROR: JAVA_HOME is not set and no ‘java’ command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.”

What is happening is that we do not have the JAVA_HOME variable added to our Windows environment variables list.

To add it, first, we need to make sure we have Java installed.

To do that, we install the Java version we need. To do this, we go to the website and download it. In my case, we are going to install OPEN JDK: https://learn.microsoft.com/es-es/java/openjdk/download

Or on the official OpenJDK website: https://openjdk.org/

We finish installing it.

Once installed, we check the installation path, in my case it is:

C:\Program Files\Microsoft\jdk-17.0.8.101-hotspot

Since I have installed JDK-17 hotspot, if you have another version, you will need to navigate to:

C:\Program Files\Microsoft\

And verify which one is correct.

Now we need to add the JAVA_HOME environment variable, to do this:

Windows 10/11:

Search within the start menu for “Environment Variables”:

Now, once found, open it and look for the Environment Variables option…

Click on New System Variable:

And add the JDK like this:

In Variable Name put: JAVA_HOME

In Variable Value put (in my case): C:\Program Files\Microsoft\jdk-17.0.8.101-hotspot

And now click on OK.

You will need to reload the console for it to find JAVA_HOME.

Leave a Comment