Java System Properties
Quick Reference Guide


jdk.io.File.enableADS Java System Property

The jdk.io.File.enableADS Java System Property accepts a boolean value (true or false)

Default Value

true

jdk.io.File.enableADS Overview

When set to false disables access to NTFS Alternate Data Streams (ADS). By default java.io.File allows access to NTFS Alternate Data Streams.

NTFS Alternate Data Streams (ADS) is a feature of the NTFS file system that allows more than one data stream to be associated with a file. It can be used for storing metadata, or compatibility purposes, however it can also be used for malicious purposes. Malware or other malicious software can hide in alternate data streams, making detection more difficult because the file size does not visibly change.

Note: This system property only applies to java applications running on Windows.

Related System Properties

Here are some other Java File system properties:

Supported Since

Java has supported the jdk.io.File.enableADS system property since 11.0.15, 8u331, and 7u341.

Setting jdk.io.File.enableADS on Startup

You can set the jdk.io.File.enableADS java system property during startup of the java runtime using the -D command line argument:

java -Djdk.io.File.enableADS=false MyAppMain

You may also be able to specify jdk.io.File.enableADS via the JAVA_TOOL_OPTIONS environment variable:

JAVA_TOOL_OPTIONS=-Djdk.io.File.enableADS=false

Setting / Reading jdk.io.File.enableADS at Runtime

You can set jdk.io.File.enableADS at runtime with the following Java code:

System.setProperty("jdk.io.File.enableADS", "false");

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.io.File.enableADS system property may be cached within an internal private static variable of the implementing class.

To read the value of jdk.io.File.enableADS at runtime, you can use this Java code:

String propertyValue = System.getProperty("jdk.io.File.enableADS");
if (propertyValue != null) {
    System.out.println("jdk.io.File.enableADS = " + propertyValue);
} else {
    System.out.println("jdk.io.File.enableADS was null");
}