Java System Properties
Quick Reference Guide


jdk.nio.zipfs.allowDotZipEntry Java System Property

The jdk.nio.zipfs.allowDotZipEntry java system property to allow dots in zip entry

Default Value

false

Overview of jdk.nio.zipfs.allowDotZipEntry

The jdk.nio.zipfs.allowDotZipEntry java system property disables the restrictions put in place to avoid infinite loop when processing a zip file with a directory named . or .. (JDK-8251329)

Because this system property can cause instability / resource exhaustion it is not recommended to set this property to true unless your application has a specific need for it.

References

Supported Since

Java has supported the jdk.nio.zipfs.allowDotZipEntry system property since Java 11.0.20 (JDK-8303878).

Setting jdk.nio.zipfs.allowDotZipEntry on Startup

You can set the jdk.nio.zipfs.allowDotZipEntry java system property during startup of the java runtime using the -D command line argument:

java -Djdk.nio.zipfs.allowDotZipEntry=true MyAppMain

You may also be able to specify jdk.nio.zipfs.allowDotZipEntry via the JAVA_TOOL_OPTIONS environment variable:

JAVA_TOOL_OPTIONS=-Djdk.nio.zipfs.allowDotZipEntry=true

Setting / Reading jdk.nio.zipfs.allowDotZipEntry at Runtime

You can set jdk.nio.zipfs.allowDotZipEntry at runtime with the following Java code:

System.setProperty("jdk.nio.zipfs.allowDotZipEntry", "true");

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 jdk.nio.zipfs.allowDotZipEntry system property may be cached within an internal private static variable of the implementing class.

To read the value of jdk.nio.zipfs.allowDotZipEntry at runtime, you can use this Java code:

String propertyValue = System.getProperty("jdk.nio.zipfs.allowDotZipEntry");
if (propertyValue != null) {
    System.out.println("jdk.nio.zipfs.allowDotZipEntry = " + propertyValue);
} else {
    System.out.println("jdk.nio.zipfs.allowDotZipEntry was null");
}