Does Java have a System Environment Variable that will always be read / added when we set it? CATALINA_OTPS
/ JAVA_OPTS
etc. seems to be only for TOMCAT / JBOSS etc.
- I don't want to install it through the properties of the Java system (which is passed through -Dprop1 = value1 -Dprop2 = value2), since it includes a shell / script package.
- It should work through the OS, for example, a double-click file in Windows.
- It should work in different JREs (Sun, IBM, OpenJDK, etc.).
- It should not include additional encoding.
- It should work in most library configuration files, for example, to set log4j level $ {LOG_LEVEL}.
Update : elements # 4 and 5 were added. Remove the OS from the title to make my question clearer.
Update 2 . After looking at the perception response, it seems that my points 2 and 3 can be achieved using System.getenv
. How to reach points 4 and 5?
Here is an example scenario: Imagine now JAVA_DEFAULT_OPTS
is an environment variable that will be considered Java, since now it has become the standard. On the development desktop machine, I set JAVA_DEFAULT_OPTS=-DLOG_LEVEL=DEBUG -Xmx384m
; On the production server server, clients set JAVA_DEFAULT_OPTS=-DLOG_LEVEL=INFO -Xmx1024m
. When I / users double-click the jar file in Windows, the application will work, the log4j level and the maximum memory heap size will differ.
source share