title: How to manage the creation and deletion of temporary files
body: <p>I'm adding code to a large JSP web application, integrating functionality to convert CGM files to PDFs (or PDFs to CGMs) to display to the user.</p>
  
  <p>It looks like I can create the converted files and store them in the directory designated by <code>System.getProperty("java.io.tmpdir")</code>. How do I manage their deletion, though? The program resides on a Linux-based server. Will the OS automatically delete from <code>/tmp</code> or will I need to come up with functionality myself? If it's the latter scenario, what are good ways to go about doing it? </p>
  
  <p>EDIT: I see I can use <code>deleteOnExit()</code> <a href="https://stackoverflow.com/questions/17122580/do-i-need-to-delete-tmp-files-created-by-my-java-application">(relevant answer elsewhere)</a>, but I think the JVM runs more or less continuously in the background so I'm not sure if the exits would be frequent enough. </p>
  
  <p>I don't think I need to cache any converted files--just convert a file anew every time it's needed. </p>