Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to store java.util.prefs.Preferences in file?

I'm using java.util.prefs.Preferences for application preferences. And I need ability to edit those preferences manually. Is it possible to store it into file instead of Windows Registry? Or I should use another mechanism instead of java.util.prefs.Preferences?

like image 476
denys Avatar asked Apr 19 '12 13:04

denys


People also ask

Where are Java Util preferences stored?

util. prefs. systemRoot . The user preferences are typically stored at user-home/.

What is preferences in Java?

public abstract class Preferences extends Object. A node in a hierarchical collection of preference data. This class allows applications to store and retrieve user and system preference and configuration data. This data is stored persistently in an implementation-dependent backing store.

What is Userprefs?

The userprefs. xml file contains a series of ParameterName elements that contain a ParameterValue element. The names of the parameters you can set are contained in the ParameterName elements. Enter the value for these parameters in the associated ParameterValue elements.

What is preference API?

Overview. The Preference API has been implemented in lib/moodlelib. php. It's used for the storage and retrieval of user preferences. These preferences are stored in the database for users with an account, however for guests or people who are not logged in the preferences are stored in a PHP Session.


1 Answers

If you want to continue using the Preferences API, but write to a file, you will need a new PreferencesFactory, as detailed in this SO post.

like image 50
Brian Agnew Avatar answered Sep 20 '22 20:09

Brian Agnew