-1

I'm not able to delete JAVA_HOME environment variable from my system. I'm using windows 10. I don't have anything as JAVA_HOME in my system variables but still in cmd if we echo %JAVA_HOME% it shows some path that didn't even exits. How to resolve this issue.

In cmd it shows this.

Microsoft Windows [Version 10.0.19042.1237] (c) Microsoft Corporation. All rights reserved.

C:\Users\nikhil.bankar>java -version 'java' is not recognized as an internal or external command, operable program or batch file.

C:\Users\nikhil.bankar>echo %JAVA_HOME%

D:\Java\Jdk1.8\bin

C:\Users\nikhil.bankar>

Dexter
  • 19
  • 3
  • Keep in mind that you must start a new `cmd`, which will load the environment variables at the start. When you use an existing `cmd` the current set environment variables are still set, independent to what you have configured in your windows settings. To be sure, you can restart your system and then check again. – Progman Oct 02 '21 at 07:38
  • 3
    Problems with environment variables are best solved at https://superuser.com. But for launching Java, the variable `JAVA_HOME` is entirely irrelevant. Run it using an absolute path or add the bin folder to the `PATH` variable, as you like. – Holger Oct 04 '21 at 07:43

2 Answers2

0

I got the same issue in the past.

I installed jdk and set environment JAVA_HOME for it. D:/jdk8

Later, i delete this folder somehow (maybe install newer version). Delete D:/jdk8 and install D:/jdk9

In my environment setting, the old value is still reference to old value.

Jdk8 folder is not existed now.

In my case, i just need to update the environment setting and restart computer.

It's work for me.

Huy Nguyen
  • 1,931
  • 1
  • 11
  • 11
-1

I also faced the same problem.

Although I un-installed JDK-10 and JRE-10 from the Windows 10, JAVA_HOME was still there.

Finally I did this:

Start -> Control Panel -> System -> Advanced System Settings

(Supply Admin password, if demanded)

'System Properties' dialog box opens up with 'Advanced' tab selected.

Click on 'Enviroment Variables' button (located at bottom edge of dialog box). In 'Environment Variables' dialog box, you get two windows:

Top window is for 'Admin' user, and Bottom window is for 'System'.

I found JAVA_HOME variable in 'System' window. I deleted it.

Also I found jdk bin directory in 'path' environment variable. I deleted this also.

You should also check in top 'Admin' window, if required.

This worked for me.