Do we now need to set Windows environment variables for Java updates?

I set Windows environment variables (e.g. JAVA_HOME ) every time I installed a Java update. (According to environment variables for installing java ).

However, I recently noticed that Java updates add C:\ProgramData\Oracle\Java\javapath; to the system path (not the user path). I deleted JAVA_HOME etc. From my User Path, while java -version seems to work from any directory.

Does this mean that there is no need to complete this simple but annoying task with every Java update?

+5
source share
3 answers

It depends on what you are trying to do.

Typically, you do not need JAVA_HOME to run a Java application. Adding the location of Java binaries to PATH enough for Windows to find and execute them.

However, for example, many application servers such as Tomcat and build tools such as Gradle will use JAVA_HOME to locate your Java installation.

+3
source

Java itself does not use JAVA_HOME. Some third-party stuff like IDE and Tomcat. I never set it as an environment variable after 20 years.

+3
source

Personally, I don’t even have JAVA_HOME, and I have been developing in this company for 6 years (and other companies for more than 10 years). For me, this tends to get in the way. The last installation sets the path to Windows, which usually does not support my IDE, Tomcat, JBoss or SOAP-UI, so I just edit all of their startup files to select / install the JAVA_HOME that they work with.

+2
source

Source: https://habr.com/ru/post/1274955/


All Articles