title: What is the best practice for securely storing passwords in Java
body: <p>What would be the recommended way for storing passwords in a Java desktop application?</p>
  
  <p>I want the user to have the ability to enter the credencials only once and not be prompted again.</p>
  
  <p>On personal projects I've been using the Preferences API, but I'm assuming this is no different than storing it in plain text (security wise).</p>
  
  <p>Many thanks</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Many thanks for your suggestions. There seems to be some confusion, no doubt because I might have not made the question very clear...</p>
  
  <p>I'll give an hypotetical scenario:</p>
  
  <p>Say I'm creating a simple front-end for a remote database which creates a connection string with username/password. Normally the user would be prompted to enter the username/password combination each time the application starts.</p>
  
  <p>What would be the best way to store that password in the user's machine, without the need to re-enter it (connecting automatically upon application start). </p>
  
  <p>A kind of "remember me" functionality (which I know in itself is not a very good practice...)</p>
  
  <p><strong>EDIT2:</strong></p>
  
  <p>Thanks for your answers everyone.
  Paŭlo Ebermann's was very informative about the problems at hand and Chris Smith's link was interesting, but I've accepted JVerstry's one, as keystores might be the route I'm taking.</p>