Java System Properties
Quick Reference Guide Java System Property

The Java System Property accepts a boolean value (true or false)

Default Value

false Explained

If the operating system that your java application is running on supports IPv6 it will attempt to use IPv6 when connecting to a host that supports IPv6.

Typically this would mean if the host's DNS records include IPv6 addresses, such as in the AAAA records.

Related System Properties

The system property is related to the property, it can be used to prefer IPv4 over IPv6 instead of IPv6 over IPv4.

Here are some other networking Java system properties:

Supported Since

Java has supported the system property since at least version 8, support may go back to even older versions of java.

Setting on Startup

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

java MyAppMain

You may also be able to specify via the JAVA_TOOL_OPTIONS environment variable:

Setting / Reading at Runtime

You can set at runtime with the following Java code:

System.setProperty("", "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 system property may be cached within an internal private static variable of the implementing class.

To read the value of at runtime, you can use this Java code:

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