P
Piper707
Hi,
We need to read xml files that are packaged inside a .jar. The .jar
lives in JBoss/server/default/lib/
How can one access the xml files from any .class file within the .jar?
If we use this approach:
URL url = this.getClass.getResource("xmlFilePath");
reader.read(url);
This works fine if the path of the xml file to be read is under the
path returned by this.getClass.getResource . But how does one access an
xml file from a .class file that lives in a directory parallel to the
xml file?
We have tried editing the path returned by this.getClass.getResource
and appending the correct path after it, but in spite of that, we get a
FileNotFoundException.
The only alternative we can think of now, is to have all the XMLFiles
in one folder under a particular .class file. So that .class file will
be used by anyone who needs to read an xml file.
Are there any other ways to work around this?
Thank for any help
Rohit.
We need to read xml files that are packaged inside a .jar. The .jar
lives in JBoss/server/default/lib/
How can one access the xml files from any .class file within the .jar?
If we use this approach:
URL url = this.getClass.getResource("xmlFilePath");
reader.read(url);
This works fine if the path of the xml file to be read is under the
path returned by this.getClass.getResource . But how does one access an
xml file from a .class file that lives in a directory parallel to the
xml file?
We have tried editing the path returned by this.getClass.getResource
and appending the correct path after it, but in spite of that, we get a
FileNotFoundException.
The only alternative we can think of now, is to have all the XMLFiles
in one folder under a particular .class file. So that .class file will
be used by anyone who needs to read an xml file.
Are there any other ways to work around this?
Thank for any help
Rohit.