5

My system is Windows 10 64 bit

I have created an environment variable "JAVA_HOME" and updated the path but, still system is showing "The JAVA_HOME" environment variable is not defined This environment variable is needed to run this program"

Also, echo %JAVA_HOME% is not displaying the path

Please review the attached screenshots.

Command prompt

System Variable

magicandre1981
  • 27,895
  • 5
  • 86
  • 127
SubbaRao P
  • 63
  • 1
  • 1
  • 5

1 Answers1

17

You need to close and reopen cmd.exe or restart the computer to get JAVA_HOME to propagate to your command prompt.

If cmd was open when you set the variables they will not be available in that session.

Noah
  • 1,683
  • 14
  • 19
  • 1
    I found this true too with JAVA_HOME (need to reboot). But not when I set a path in the Path: for entries in the system variable Path I didn't need to reboot. (Win7/8/10) Why is that? – JasonH Jan 04 '18 at 20:02
  • I added JAVA_HOME in the environment variables list of Windows 10 pointing to D:\Apps\jdk-17.02, where I have extracted this jdk files, and in the system variable path I added this '%JAVA_HOME%\bin; and in my cmd console I see that path statement has '%JAVA_HOME%\bin' where as it supposed to translated to 'D:\Apps\jdk-17.02\bin' but not. why? – Sansun Feb 23 '22 at 15:02