viper25

Read properties file from Java resources

Apr 13th, 2016
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.32 KB | None | 0 0
  1. String path = new File("src\\main\\resources\\people.txt").getAbsolutePath();
  2.  
  3. String Path = new File("").getAbsolutePath();
  4. String filePath = Path.concat(sep + "myprop.properties");
  5. FileInputStream fis = new FileInputStream(filePath);
  6. prop = new Properties();
  7. prop.load(fis);
  8. System.out.println("Prop: " + filePath);
Advertisement
Add Comment
Please, Sign In to add comment