Java System Properties
Quick Reference Guide


java.xml.config.file Java System Property

The java.xml.config.file Java System Property allows you to specify a custom jaxp.properties file path.

Default Value

When you do not specify java.xml.config.file, the values specified in the in the jvm's conf/jaxp.properties default config file are used.

java.xml.config.file Explained

Several properties can be defined in a jaxp.properties file which determine how the Java API For XML Parsing or JAXP operates.

Related System Properties

Here are some other XML java system properties:

References

Supported Since

Java has supported the java.xml.config.file system property since Java version 21.

Setting java.xml.config.file on Startup

You can set the java.xml.config.file java system property during startup of the java runtime using the -D command line argument:

java -Djava.xml.config.file=/etc/myapp/jaxp.properties MyAppMain

You may also be able to specify java.xml.config.file via the JAVA_TOOL_OPTIONS environment variable:

JAVA_TOOL_OPTIONS=-Djava.xml.config.file=/etc/myapp/jaxp.properties

Setting / Reading java.xml.config.file at Runtime

You can set java.xml.config.file at runtime with the following Java code:

System.setProperty("java.xml.config.file", "/etc/myapp/jaxp.properties");

WARNING: Depending on the property and JVM version using setProperty may or may not work if the JDK Java class that uses this variable has already been loaded. The value of the java.xml.config.file system property may be cached within an internal private static variable of the implementing class.

To read the value of java.xml.config.file at runtime, you can use this Java code:

String propertyValue = System.getProperty("java.xml.config.file");
if (propertyValue != null) {
    System.out.println("java.xml.config.file = " + propertyValue);
} else {
    System.out.println("java.xml.config.file was null");
}