Tag: bundle预览模式: 普通 | 列表
09-03
13

用java读取properties文件

今天为了通过java读取properties文件,google了很长时间,终于找到了。现在特记录之和大家一起分享。
    下面直接贴出代码:java类
public class Mytest
public static void readFile(String fileName) {//传入参数fileName是要读取的资源文件的文件名如(file.properties)
InputStream in = null;
Properties pros = new Properties();
try {
if (null != fileName) {
in = Mytest.class.getResourceAsStream(fileName);//得到当前类的路径,并把资源文件名作为输入流

查看更多...

Tags: properties bundle

分类:学习 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 442