title: Changing JAVA DNS Cache settings
body: <p>I am using java8 for my web application. I would like to change the settings of JAVA DNS Cache.
  This is the code:</p>
  
  <pre><code>java.security.Security.setProperty("networkaddress.cache.ttl", "60");
  java.security.Security.setProperty("sun.net.inetaddr.negative.ttl", "10");
  </code></pre>
  
  <p>I would like to know where exactly I should write the code (in which class file) to reflect the changes in JVM before DNS chance gets initialised.</p>
  
  <p>I would like to make the change using a  java utility class file.Please suggest for the same. 
  And also suggest how to configure the same change in build.xml(ant)?</p>
  
  <p>I agree with answers updated where they have suggested to change security file.But i would like to know the configuration in other ways too due to limitations that i have in my project.</p>