方法getResourceAsStream()是一个标准方法,用来打开一个外部输入文件。文件的位置取决于类加载器,而标准的类加载器从classpath开始搜索
如:c:/temp/mytest/Test.class

  package   mytest;  
  public   class   Test{...}  
   
  Test.class.getResourceAsStream(str);  
   
  str="/db.properties"   则   db.properties   放在   c:/temp下  
  str="db.properties"   则   db.properties   放在c:/temp/mytest下

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
猜你喜欢
  • 2022-01-21
  • 2021-08-11
  • 2021-07-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案