title: Detecting your application's install path in Java?
body: <p>I have made a small application in Java and I would like to make a windows installer for it using the Nullsoft Scriptable Install System (<a href="http://nsis.sourceforge.net/Main_Page" rel="nofollow noreferrer">http://nsis.sourceforge.net/Main_Page</a>).</p>
  
  <p>The application I made needs to save user preferences somewhere and it currently saves it in the user's home directory (e.g. c:\Users\danny or /home/users/danny). However if the windows installer installs the application to e.g. c:\Program Files\whatever\ I should probably save the preferences file there too, right?</p>
  
  <p>How would I detect that directory path in Java? What would be a good cross-platform approach to this without losing the benefits of a windows uninstaller for windows users e.g. start menu icons, installer option, etc?</p>
  
  <p>Should I just continue saving my preferences in the user's home path and clutter it up?</p>
  
  <p>Thanks very much,</p>