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

George Hernandez :

I've been setting Windows environment variables (like JAVA_HOME) every time I installed a Java update. (As per Environment variables for java installation).

However, I've recently noticed that Java updates add C:\ProgramData\Oracle\Java\javapath; to the System Path (not the User Path). I removed JAVA_HOME, etc from my User Path, and java -version seems to work from any directory.

Does that mean that it is not necessary to do that simple but annoying task with each Java update?

Timo :

That depends on what you are trying to do.

Generally, you don't need JAVA_HOME to run a Java app. Adding the location of the Java binaries to the PATH is sufficient for Windows to find and execute them.

However, e.g. a lot of application servers like Tomcat and build tools like Gradle will use JAVA_HOME to determine the location of your Java installation.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=474883&siteId=1