How to set system variables from Java?
<p>I need to set certain system variables from within the program. My Google fu is failing me in finding any way to do it. How do I do it? (I am okay with hacky approaches. I need to be able to run this app on Windows, Linux, and Mac.)</p>

<p><strong>Edit:</strong></p>

<p>Adding here my comment from below the post, as it isn't readily visible there:</p>

<blockquote>
  <p>The best link I could found was <a href="http://stackoverflow.com/questions/318239/how-do-i-set-environment-variables-from-java">this</a>, and it sets the variables only in memory. They do not persist after the program exit.</p>
</blockquote>

<p><strong>Edit:</strong></p>

<p>I am writing an installer and need to somehow record at system level that installation happened (along with paths to some directories). The next time user runs the setup, the installer will check if the variables already exist in the system, in which case a user will be given an appropriate warning. </p>

<p>If twiddling with environment variables is not a good idea, what will be the best approach to achieve the above?</p>
