Loading a configuration file from the classpath

前端 未结 4 1816
眼角桃花
眼角桃花 2020-12-17 04:43

I\'m working on making my Java app easy to deploy to other computers and am writing an ant script to do so, that is going fine.

I\'m having trouble loading resources

4条回答
  •  借酒劲吻你
    2020-12-17 05:14

    As far as I know, log4j.xml should be at root of your classpath..

    and also, you can read your configuration file with below code script. and config directory should be at your classpath.

    this.xml = this.getClass().getResourceAsStream("/config/configuration.xml"); 
    

提交回复
热议问题