java.xml.config.file
Java System Property allows you to specify a custom jaxp.properties
file path.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
ExplainedSeveral properties can be defined in a jaxp.properties
file which determine how the Java API For XML Parsing or JAXP operates.
Here are some other XML java system properties:
javax.xml.accessExternalDTD
jdk.xml.elementAttributeLimit
jdk.xml.enableExtensionFunctions
jdk.xml.entityExpansionLimit
jdk.xml.maxXMLNameLimit
Java has supported the java.xml.config.file
system property since Java version 21.
java.xml.config.file
on StartupYou 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
java.xml.config.file
at RuntimeYou 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"); }