首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Java中读取属性文件

在Java中读取属性文件
EN

Stack Overflow用户
提问于 2016-02-23 01:21:56
回答 1查看 255关注 0票数 0

我的代码无法读取属性文件。这里有人能帮上忙吗?它打印无法找到文件。

代码语言:javascript
复制
BufferedReader br = null;
String strLine = "";
try {
    br = new BufferedReader( new FileReader("C:/common-test/common-test/translationtest/messages_ja.property"));
    while( (strLine = br.readLine()) != null){
        System.out.println(strLine);
    }
} catch (FileNotFoundException e) {
    System.err.println("Unable to find the file: fileName");
} catch (IOException e) {
    System.err.println("Unable to read the file: fileName");
}
EN

回答 1

Stack Overflow用户

发布于 2016-02-23 01:24:15

尝试使用此\\

代码语言:javascript
复制
 "C:\\common-test\\common-test\\translationtest\\messages_ja.property"

您确定要使用.property还是.properties

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35559899

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档