Java相当于app.config? [英] Java equivalent to app.config?

查看:281
本文介绍了Java相当于app.config?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在与.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)

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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆