Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Caleb Smith   on Jul 26 In Java Category.

  
Question Answered By: Kyle Fox   on Jul 26

Use the same classloader that loaded the classes.
Put the xml  file and other files  you wish to load  right next to the
class files, then:

InputStream is = getClass().getClassLoader().getResourceAsStream();
try
{
// use 'is' here to extract the DOM from, DocumentBuilderFactory, etc...
}
finally
{
is.close();
}

Share: 

 
 
Didn't find what you were looking for? Find more on Reading XML file Or get search suggestion and latest updates.


Tagged: