title: Java: java.util.Preferences Failing
body: <p>My program saves encrypted product key data to the computer with the <code>java.util.Preferences</code> class (system preferences, not user).  The problem is, on both Windows and Linux (haven't tested on OSX, but it's probably the same), if I don't run the program with <code>sudo</code> or with Administrator privileges, it emits an exception or warning whenever it tries to read or save the data.</p>
  <p>Obviously requiring the user to run the program with Admin privileges would be impractical.  Optimally, I'd like the operating system to ask the user for permission.</p>
  <p>This is quite silly, and removes half the purpose of <code>Preferences</code>.  How can this be fixed?</p>
  <p><strong>Here's a summary what I need</strong>: I need my program to ask for permission from the operating system to save system settings.</p>
  <hr />
  <h3>Here is the error information</h3>
  <p>Here's the error when the when I try to read a node (because the node doesn't exist):</p>
  <pre><code>Mar 18, 2011 9:41:15 AM java.util.prefs.WindowsPreferences &lt;init&gt;
  WARNING: Could not create windows registry node Software\JavaSoft\Prefs\myapp at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
  Mar 18, 2011 9:41:15 AM java.util.prefs.WindowsPreferences WindowsRegOpenKey1
  WARNING: Trying to recreate Windows registry node Software\JavaSoft\Prefs\myapp at root 0x80000002.
  Mar 18, 2011 9:41:15 AM java.util.prefs.WindowsPreferences openKey
  WARNING: Could not open windows registry node Software\JavaSoft\Prefs\myapp at root 0x80000002. Windows RegOpenKey(...) returned error code 2.
  Mar 18, 2011 9:41:15 AM java.util.prefs.WindowsPreferences WindowsRegOpenKey1
  WARNING: Trying to recreate Windows registry node Software\JavaSoft\Prefs\myapp\subpackage at root 0x80000002.
  Mar 18, 2011 9:41:15 AM java.util.prefs.WindowsPreferences openKey
  WARNING: Could not open windows registry node Software\JavaSoft\Prefs\myapp\subpackage at root 0x80000002. Windows RegOpenKey(...) returned error code 2.
  </code></pre>
  <p>And this is what happens when I try to write to a node:</p>
  <pre><code>Mar 18, 2011 9:43:11 AM java.util.prefs.WindowsPreferences WindowsRegOpenKey1
  WARNING: Trying to recreate Windows registry node Software\JavaSoft\Prefs\myapp\subpackage at root 0x80000002.
  Mar 18, 2011 9:43:11 AM java.util.prefs.WindowsPreferences openKey
  WARNING: Could not open windows registry node Software\JavaSoft\Prefs\myapp\subpackage at root 0x80000002. Windows RegOpenKey(...) returned error code 2.
  </code></pre>