how to add an xml file to the java application's classpath in eclipse?

后端 未结 3 1419
盖世英雄少女心
盖世英雄少女心 2021-02-19 01:02

I need an xml file to be accessed via the classpath in a java application i am creating . how to achieve it in eclipse

3条回答
  •  梦如初夏
    2021-02-19 01:50

    Put the directory containing the XML in the runtime classpath, then use className.Class.getResourceAsStream() to get an InputStream containing the XML.

提交回复
热议问题