title: What's a good place to save a file to in a Java app?
body: <p>I have a Web Start application which needs to save a single text file. I would like to know where I should write the file, such that it goes in a tidy place regardless of the platform it runs on.</p>
  
  <p>If I get my filepath like this...</p>
  
  <pre><code>new File(System.getProperty("user.dir") + System.getProperty("file.separator") + "test.txt);
  </code></pre>
  
  <p>... then the file gets written somewhere nice and inconspicuous on Linux, but on the desktop on Windows, alongside the icon I'm running the program from, and that's not ideal because the user shouldn't necessarily need to know or care that the file exists.</p>
  
  <p>Is there a good, platform-independent way of getting a file path that allows me to save a file somewhere discreet? I don't much care where it ends up, providing it's not in full view on the desktop.</p>
  
  <p>Thanks.</p>
  
  <p>Neil</p>