读取包内文件,使用的路径一定是相对的classpath路径,比如a,位于包内,此时可以创建读取a的字节流:
InputStream in = ReadFile.class.getResourceAsStream("/com/lavasoft/res/a.txt");
有了字节流,就能读取到文件内容了。

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2021-11-29
  • 2021-08-05
  • 2021-12-24
  • 2022-12-23
猜你喜欢
  • 2021-07-28
  • 2022-12-23
  • 2021-07-09
  • 2021-06-09
  • 2021-12-24
  • 2021-06-08
相关资源
相似解决方案