Override system property in Java (no code)

Is it possible to override system properties (time zone, etc.) in Java using a predefined property file for all Java applications?

I could not find such a file in my 64-bit Windows 7 OS.

Java Version 1.7.0_03 (JDK 64 bit)

Java "-Duser.timezone parameter cannot be used because it is a compiled executable file (does not accept Java parameter). And we use these Java applications as end users. We have not developed them. Therefore, setting the time zone using programming is not option.

Java uses a different time zone than the system one. I think there are some bugs with Java with Windows 7.

http://oraclesoon.blogspot.com/2010/04/windows-7-and-java-jdk-16-timezone.html

+7
source share
1 answer

The _JAVA_OPTIONS envionment variable allows you to set command line flags when java starts.

The following are distributed in java for me (on OSX):
export _JAVA_OPTIONS='-Duser.timezone=Europe/Copenhagen'

It's hard to know if it will work with your .exe installation, but try it.

You may need to reboot after changing the environment variables on the windows.

+8
source

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


All Articles