InputStream inputStream = new FileInputStream(new File(this.getClass().getResource("/example.txt").getFile()))
This method will cause error like as "/.../.../...jar!/example.txt (no such file or directory)" .
InputStream inputStream = getClass().getResourceAsStream("/example.txt")
This method will run right.
So, what's the difference between those two methods? And why the first method does't work?