用Java做设置文件的最简单方法是什么? [英] What is the simplest way to do settings files in Java?

查看:40
本文介绍了用Java做设置文件的最简单方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显然,我想避免对应用程序中的路径等进行硬编码,因此,我想制作一个设置文件来存储诸如字符串之类的简单内容.这样做最简单的方法是什么?我在思考可可如何使用对象持久性的思路,但似乎找不到任何等效的方法.

Obviously enough, I want to avoid hardcoding paths and such into my application, and as a result, I'd like to make a settings file that will store simple things like strings and such. What is the simplest way to do so? I was thinking something along the lines of how Cocoa uses object persistence, but I can't seem to find anything equivalent.

推荐答案

您可以使用属性文件> java.util.Properties 类.

You could use properties files which are manipulated with the java.util.Properties class.

这篇关于用Java做设置文件的最简单方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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