Joh*_*ees 1 java maven readfile
有没有办法maven.properties用Java 读取jar/war文件中的文件()的内容?我需要从磁盘读取文件,当它没有被使用时(在内存中).有关如何做到这一点的任何建议?
此致,Johan-Kees
String path = "META-INF/maven/pom.properties";
Properties prop = new Properties();
InputStream in = ClassLoader.getSystemResourceAsStream(path );
try {
prop.load(in);
}
catch (Exception e) {
} finally {
try { in.close(); }
catch (Exception ex){}
}
System.out.println("maven properties " + prop);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8375 次 |
| 最近记录: |