java.util.prefs.Preferences

O

Oliver Hirschi

Hi

I have just now read from the java API "java.util.prefs.Preferences".
Does anyone know where the preferences are stored?
I have read, they should be still available after a shutdown and restart
of the application.
What is with the preferences after a restart of the system?

Thanx.
 
J

Jon A. Cruz

Oliver said:
Hi

I have just now read from the java API "java.util.prefs.Preferences".
Does anyone know where the preferences are stored?
I have read, they should be still available after a shutdown and restart
of the application.
What is with the preferences after a restart of the system?

Thanx.

I think that on Windows they are stored in the registry, and under Linux
they are store in a hierarchy of nestled hidden directories in the
user's home directory.

~/.java/.userPrefs/... on my box at the moment.
 
A

Armel HERVE

I think that on Windows they are stored in the registry, and under Linux
they are store in a hierarchy of nestled hidden directories in the
user's home directory.

~/.java/.userPrefs/... on my box at the moment.
Is it possible to use it with non signed applet ?
 
T

Thomas Weidenfeller

Oliver Hirschi said:
I have just now read from the java API "java.util.prefs.Preferences".
Does anyone know where the preferences are stored?

This depends on the operating system. E.g. on Windows the registry is
used. On Solaris it is a file under /etc.

/Thomas
 
A

Andy Flowers

You don't need to know where they are stored, only that they are persistent.
The API offers the contract that each JVM on each platform implements as it
sees fit, all it has to do is honour the contract.

However, in Windows I believe they are stored in the registry, and in
Unix/Linux I guess there would be textual properties files.
 
O

Oliver Hirschi

Andy Flowers said:
You don't need to know where they are stored, only that they are persistent.
The API offers the contract that each JVM on each platform implements as it
sees fit, all it has to do is honour the contract.

What about different JVMs. Do they use the same Preferences?
 
A

Andy Flowers

Not sure I understand the question but here's a stab at an answer.

EVERY jvm that implements the Preferences API will support the sames API
calls. How they are implemented is up to the JVM. The Preferences class is
the same in every JVM, it uses a JVM/OS specific class that implements the
PreferencesFactory to define the physicalities of the storage.

Have a look at the API documentation for Preferences, it has all you need
right in there.
 
J

Jon A. Cruz

Andy said:
However, in Windows I believe they are stored in the registry, and in
Unix/Linux I guess there would be textual properties files.

Actually, they're xml files stored in hidden directory hierarchies.
 
C

Chris Riesbeck

Not sure I understand the question but here's a stab at an answer.

If, for example, a Windows user switches JVM's, that
user's Java applications may all fail to find the
preferences they used to have.

That's pretty annoying, but from the docs it sounds like
that could happen.
 

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,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top