title: Java better way to delete file if exists
body: <p>We need to call <code>file.exists()</code> before <code>file.delete()</code> before we can delete a file E.g.</p>
  
  <pre><code> File file = ...;
   if (file.exists()){
       file.delete();
   }  
  </code></pre>
  
  <p>Currently in all our project we create a static method in some util class to wrap this code. Is there some other way to achieve the same , so that we not need to copy our utils file in every other project.</p>