获取java.nio.file.NoSuchFileException:

时间:2018-09-05 06:09:36

标签: java file-io

我在/ common下有一个名为upgradePagePromoCodeState.json的文件。

当我使用这样的文件路径时:

/work/xxx/app/src/main/webapp.war/common/upgradePagePromoCodeState.json

它在本地执行,但不是分阶段执行。 我该如何为在舞台上以及在本地工作做好准备?

String filePath = "/work/xxx/app/src/main/webapp.war/common/upgradePagePromoCodeState.json";
try {
    String jsonText = new String(Files.readAllBytes(Paths.get(filePath)));
} catch (IOException e) {
    logger.log(Level.SEVERE, "Error while pasing a file", e);
}

0 个答案:

没有答案