How to set JAVA_HOME in your in your environment

→ Are you a new visitor? Please visit the page guidance for new visitors ←

How to set JAVA_HOME in your in your environment

When installing some applications that would require to set JAVA_HOME path for your environment you would need in most cases to manually set the JAVA_HOME path as it would not be there automatically.

Normally the error you get for this is:

Adding JAVA_HOME in your windows environment

To fix this error you just need to be sure you know where your JRE or JDK (depends on which one you need, in my case I needed the JDK path) folder path. This should be on windows inside the location

if you are using x64 then check

Then once you have the JRE or JDK path, follow:

  1. Right-click the My Computer icon on your desktop and select Properties.
  2. Click the Advanced tab.
  3. Click the Environment Variables button.
  4. Under System Variables, click New.
  5. Enter the variable name as JAVA_HOME.
  6. Enter the variable value as the installation path for the Java Development Kit, for eg.

Click ok and apply changes and also close any command prompt you still have opened.

Another method of doing this is using CMD directly, type the following command:

This should create the JAVA_HOME variable with the given value.

In some case when you need this variable, you probably also need to make some more changes to your system path. In my case I had to install Maven so I needed to add the bin folder to the system PATH so that you can use the binary in any folders or in your JAVA applications.

To do this, I use the command line method, see bellow:

%PATH% is the current system PATH value, so after we declare our own, we add after the semicolons the existing current PATH value.

And that would be all for this tutorial, will see you again in our next one.

Request an article ←