代码片段如下:
private static final String PATH = "/static/static/i18n/i18_zh.properties";
private void updateProp(String key,String val,String path) throws IOException {
Properties pp = new Properties();
InputStream stream = this.getClass().getResourceAsStream(path);
pp.load(new InputStreamReader(stream,"utf-8"));
pp.setProperty(key,val);
String resource = getClass().getResource(path).getPath();
String decode = URLDecoder.decode(resource, "utf-8");
FileOutputStream outputStream = new FileOutputStream(decode);
OutputStreamWriter writer = new OutputStreamWriter(outputStream, "utf-8");
pp.store(writer,"Update,key="+key+";value="+val);
}
在本地运行好的,linux上就报路径错误,报错信息如下:
在网上找了很多linux路径相关的,都没搞明白。跪求大神指教!