Results 1 to 5 of 5
  1. #1
    typedef is offline Member
    Join Date
    Feb 2014
    Posts
    52
    Rep Power
    0

    Default Programming to the Registry (Preferences API)

    Hello everyone, I'm learning Java and came across saving user preferences. As I was learning I also learned about object serialization and File input/output. I've heard that the windows registry can be a problem because it can quickly become a dumping ground for uninstalled programs. So my question is why should I use the Preferences API? and is it really good practice to program to the registry for saving information? I'd also like to be in good standing towards the programs I write so if it is common practice to write to the Registry how exactly would I manage the information that I dump into the Registry?

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Programming to the Registry (Preferences API)

    The Preferences API may write to the registry. It depends on the implementation. OpenJDK on Linux writes plain XML files in ~/.java/.userPrefs.

    Use the Preferences API if it meets your needs, and let your Java API vendor worry about how it does what it does.
    Get in the habit of using standard Java naming conventions!

  3. #3
    typedef is offline Member
    Join Date
    Feb 2014
    Posts
    52
    Rep Power
    0

    Default Re: Programming to the Registry (Preferences API)

    On the implementation of Windows I've seen many resources say it does write to the registry. Now the thing is I don't write all my programs with an installer and uninstall so I'd like to know if this is a safe practice. I would like to know if writing programs like this is damaging towards clients and etc. as I've written above.

  4. #4
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: Programming to the Registry (Preferences API)

    Just because one particular implementation uses the registry doesn't mean they all will. There's nothing unsafe about it, except that it's not secure; don't store passwords in it or anything like that. But the idea that unused registry keys slows down the system in some way is mostly (if not entirely) nonsense spread by people selling "registry cleaners".
    Get in the habit of using standard Java naming conventions!

  5. #5
    typedef is offline Member
    Join Date
    Feb 2014
    Posts
    52
    Rep Power
    0

    Default Re: Programming to the Registry (Preferences API)

    Alright then I'll code the Preferences API to my hearts content until proven otherwise. Thank you

Similar Threads

  1. Swing GUI for preferences
    By noodle_variation_187-X in forum AWT / Swing
    Replies: 5
    Last Post: 04-17-2013, 12:18 PM
  2. Storing preferences
    By kiloran in forum New To Java
    Replies: 3
    Last Post: 01-10-2013, 02:51 PM
  3. Shared Preferences
    By johnsonjp34 in forum Android
    Replies: 0
    Last Post: 12-29-2012, 07:23 PM
  4. Failure of Preferences API under OSX
    By JerryAgin in forum Advanced Java
    Replies: 2
    Last Post: 02-29-2012, 10:20 AM
  5. java.util.Preferences
    By jon80 in forum New To Java
    Replies: 0
    Last Post: 06-06-2009, 11:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •