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?
Java does not need any environment variables to be set. However, setting some environment variables makes some things easier. PATH If the jre/bin folder is on the path, you don't have to qualify to run the java command. If the jdk/bin folder is on the path, you don't have to qualify to run the java and javac commands.
After you've installed Java in Windows, you must set the JAVA_HOME environment variable to point to the Java installation directory. This information is only relevant if you're installing Confluence manually on a Windows server.
JAVA_HOME and PATH are variables to enable your operating system to find required Java programs and utilities.
Environment variables not recommended for every situation Environment variables provide a good way to set application execution parameters that are used by processes that you do not have direct control over. However, environment variables should not be used for configuration values within your own dynamic applications.
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.
Java itself does not use JAVA_HOME. Some third-party things like IDEs and Tomcat do. I've never set it as an environment variable in 20 years.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With