java.util.prefs: storing the preferences somewhere else

V

Veerle

Hi,

I would like to implement a subclass of the Preferences class that
doesn't store everything into the Windows registry, but in an xml
file. Does anyone have example code of
- a subclass of the Preferences class
- an implementation of PreferencesFactory for this Preferences class
- an implementation of both the listeners for this Preferences class
- and a small example program that uses the above?
This would be a great help when starting out my own implementation...
This sample code doesn't have to store the preferences in an xml file,
any other location than the Windows registry will do, it's just to get
an idea of how to start of with my own thing.

Thanks in advance,
Veerle
 
D

Daniel Dyer

Hi,

I would like to implement a subclass of the Preferences class that
doesn't store everything into the Windows registry, but in an xml
file. Does anyone have example code of
- a subclass of the Preferences class
- an implementation of PreferencesFactory for this Preferences class
- an implementation of both the listeners for this Preferences class
- and a small example program that uses the above?
This would be a great help when starting out my own implementation...
This sample code doesn't have to store the preferences in an xml file,
any other location than the Windows registry will do, it's just to get
an idea of how to start of with my own thing.

Thanks in advance,
Veerle


Well the Linux version of the JRE stores preferences in an XML file under
the user's home directory, so it might be worth investigating that. I
don't know if there's some property you can set to get it to behave this
way on Windows. If not, you can probably take a look in the source for
the Linux version and get some ideas from that.
 
R

Roedy Green

Well the Linux version of the JRE stores preferences in an XML file under
the user's home directory, so it might be worth investigating that. I
don't know if there's some property you can set to get it to behave this
way on Windows. If not, you can probably take a look in the source for
the Linux version and get some ideas from that.

There is a problem with Windows and JNLP in that you don't get
assigned a directory to work in. There is no natural place to put
your file. You will have to invent some file-naming convention and
tree-like directory structure to store the preferences. Again you
might take a lead from how they pull it off in Linux.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,281
Latest member
Pedroaciny

Latest Threads

Top