I'm attempting to disable IP caching for my Web Start application. I would like to do this automatically so the end user does not need to manually modify a properties file.
In the application, I have the line:
java.security.Security.setProperty("networkaddress.cache.ttl" , "0");
When I run this as a standalone application, it works fine. But if I include this in a jar and launch as a Web Start application, it no longer works. The property is set as expected, but the initial IP address is still cached.
I have attempted to set this property in other ways too, such as:
- Setting the property in the jnlp file. For example:
<resources>
<j2se version="1.4+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="DnsTest.jar"/>
<property name="networkaddress.cache.ttl" value="0"/>
</resources>
- Setting the analogous Sun-specific property (sun.net.inetaddr.ttl) in the jnlp file
- Prepending "java.security." to the names of these properties
- Setting the property in the code using System.setProperty()
- Setting the property as a jvm argument in the jnlp. For example:
<j2se version="1.4+" href="http://java.sun.com/products/autodl/j2se" java-vm-args="-Dnetworkaddress.cache.ttl=0"/>
- Setting this property on the javaws command-line
- Using the command-line:
"javaws -userConfig deployment.javaws.secure.properties networkaddress.cache.ttl"
with networkaddress.cache.ttl specified in the jnlp
Please let me know if you have any recommendations.
Thank you.