m0s
m0s

Reputation: 4280

How to store Java desktop application(multiplatform) global settings?

What do I need exactly is to store information like applications first execution date and few settings somewhere on the user machine. The program will be distributed on Windows and Mac OS. This information needs to be shared between the users on same machine... somewhat global settings. On windows I'd probably store this information in registry, not sure about Macs... I'd really like a multiplatform solution for this, otherwise please advise platform specific ones.

Upvotes: 1

Views: 1265

Answers (3)

Bozho
Bozho

Reputation: 597036

use java.util.prefs.Preferences

If you want all users on the machine to use the same properties, use Preferences.systemRoot() (rather than Preferences.userRoot())

Upvotes: 6

Riduidel
Riduidel

Reputation: 22292

If @bozho excellent proposal does not fullfils your requirements, you can also go the Apache way, by using commons configuration.

Upvotes: 2

Qwerky
Qwerky

Reputation: 18405

Try the Preferences class. It can store user or system preferences. Sounds like you need to use system preferences as they are the same for all users.

The implementation is system specific, for Windows it will use the registry. Not sure about Mac.

Upvotes: 2

Related Questions