【发布时间】:2017-04-04 22:18:38
【问题描述】:
try {
byte[] encoded = Files.readAllBytes(Paths.get(getClass().getResource("/files/game.json").getFile()));
return new String(encoded);
} catch (Exception e) {
return "";
}
这个块在osx上工作,但是当我尝试在windows上运行它时,它找不到相对路径。
【问题讨论】:
标签: java path relative-path