Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. 用类加载器加载,路径默认为根目录
  2. Properties properties=new Properties();
  3. properties.load(this.getClass().getClassLoader().getResourceAsStream(path));
  4.  
  5. 用普通文件加载方式加载,此时是路径为相对路径,用"/"指定
  6. Properties props = new Properties();
  7. props.load(new InputStreamReader(new FileInputStream(path), "utf-8"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement