java.security.properties Java System Property accepts a file path to load java security properties.java.security.propertiesIf the Java Security Property security.overridePropertiesFile is set to true (the default), then the security properties of the JVM can be overridden by values specified in the properties file that is pointed to via the java.security.properties system property.
If the system property is set with two equal signs, == then that file will completely override the master security properties file (shipped with the JVM).
-Djava.security.properties==/path/to/security_override.properties
java.security.properties on StartupYou can set the java.security.properties java system property during startup of the java runtime using the -D command line argument:
java -Djava.security.properties=/path/to/security_override.properties MyAppMain
You may also be able to specify java.security.properties via the JAVA_TOOL_OPTIONS environment variable:
JAVA_TOOL_OPTIONS=-Djava.security.properties=/path/to/security_override.properties
java.security.properties at RuntimeYou can set java.security.properties at runtime with the following Java code:
System.setProperty("java.security.properties", "/path/to/security_override.properties");
WARNING: Depending on the property and JVM version using
setPropertymay or may not work if the JDK Java class that uses this variable has already been loaded. The value of the java.security.properties system property may be cached within an internal private static variable of the implementing class.
To read the value of java.security.properties at runtime, you can use this Java code:
String propertyValue = System.getProperty("java.security.properties");
if (propertyValue != null) {
System.out.println("java.security.properties = " + propertyValue);
} else {
System.out.println("java.security.properties was null");
}