问题描述
是否存在与.NET的App.Config相当的Java?
Is there a Java equivalent to .NET's App.Config?
如果没有标准方法可以保留应用程序设置,那么可以在以后更改它们应用程序已分发?
If not is there a standard way to keep you application settings, so that they can be changed after an app has been distributed?
推荐答案
对于WebApps,web.xml可用于存储应用程序设置。
For WebApps, web.xml can be used to store application settings.
除此之外,你可以使用类读取和写入属性文件。
Other than that, you can use the Properties class to read and write properties files.
您可能还想查看类,用于读写系统和用户首选项。它是一个抽象类,但您可以使用 userNodeForPackage(ClassName.class)
和 systemNodeForPackage(ClassName.class)$ c $获取适当的对象c>。
You may also want to look at the Preferences class, which is used to read and write system and user preferences. It's an abstract class, but you can get appropriate objects using the userNodeForPackage(ClassName.class)
and systemNodeForPackage(ClassName.class)
.
这篇关于Java相当于app.config?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!