Loading an XML file that is in a classpath in Java

I need to load the xml file present in the classpath into my java application. Can anyone give suggestions on this.

Thank you
Narendra

+5
source share
1 answer

Use ClassLoader.getResourceAsStreamor Class.getResourceAsStream, and then download it as you would for others InputStream.

( ClassLoader Class , "" . ClassLoader , Class , "/", .)

+12

All Articles