Java System Properties
Quick Reference Guide

networkaddress.cache.negative.ttl Java Security Property

The networkaddress.cache.negative.ttl Java Security Property accepts an integer value corresponding to the number of seconds to cache

Default Value


The default value of networkaddress.cache.negative.ttl is 10 seconds.

networkaddress.cache.negative.ttl Explained

When Java resolves a a hostname into an IP address (for example by performing a DNS lookup) it will cache the value for a period of time. The amount of time a successful lookup is cached for is determined by the networkaddress.cache.ttl security property. The networkaddress.cache.negative.ttl security property specifies the number of seconds that a failed lookup will be cached for.

Related Properties

The system property is an implementation specific private system property that corresponds to this Java Security Property.

When the value of networkaddress.cache.negative.ttl is -1 it will cache lookup failures forever (the duration of the JVM process), when set to 0 no caching will be performed on lookup failures.

Here are some other Java properties related to networking:

Supported Since

Java has supported the networkaddress.cache.negative.ttl security property since at least version 6, support may go back to even older versions of java.

Setting / Reading networkaddress.cache.negative.ttl at Runtime

You can set networkaddress.cache.negative.ttl at runtime with the following Java code:"networkaddress.cache.negative.ttl", "10");

Please note that the networkaddress.cache.negative.ttl value needs to be specified early, before the internal java classes are loaded that might use this value otherwise it will be ignored.

To read the value of networkaddress.cache.negative.ttl at runtime, you can use this Java code:

String propertyValue ="networkaddress.cache.negative.ttl");
if (propertyValue != null) {
    System.out.println("networkaddress.cache.negative.ttl = " + propertyValue);
} else {
    System.out.println("networkaddress.cache.negative.ttl was null");

Setting networkaddress.cache.negative.ttl on Startup

Be aware that networkaddress.cache.negative.ttl is not a Java System Property, it is a Java Security Property. Therefor you cannot set it from the command line using -Dnetworkaddress.cache.negative.ttl. You have to set networkaddress.cache.negative.ttl in the properties file.