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 file path.

Default Value

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

java.xml.config.file Explained

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

Related System Properties

Here are some other XML java system properties:


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/ MyAppMain

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


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/");

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");