简体   繁体   中英

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.

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.

如果@bozho出色的建议不能满足您的要求,您还可以使用commons配置使用Apache方式。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM