开发者

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, otherwis开发者_运维技巧e please advise platform specific ones.


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())


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜