tags:

views:

31

answers:

2

I have a jar file named "xyz.jar" that have the file "abc.xml" and I have one more file with same name "abc.xml" not bundled with "xyz.jar" . I would like to have the JBoss to see the "abc.xml" which isnt bundled with "xyz.jar" in the first place before it sees the one that is bundled with "xyz.jar". The reason is , the file "abc.xml" that placed externally can be exposed for modification and that way Jboss can see that modification without restarting the server.

How can I achieve this .. I mean how can I set the classpath for Jboss to see the "abc.xml" that isnt bundled with "xyz.jar" in the first place ?

A: 

It isn't about the JBoss classpath. It depends on the way you chose to open your resource abc.xml into your jar xyz.jar

Colin Hebert
right .. I am wondering which "abc.xml "will be loaded first ? .. that acutally matters . I would like to have the Jboss to see the modifications that happened on the "abc.xml" which isnt bundled with "xyz.jar"
Sukhhhh
A: 

If you know the location of abc.xml on your filesytem you can just load it using a fully qualified path. For example

final InputStream is = new FileInputStream("/foo/bar/abc.xml");
Jon Freedman
I'd recommend "getResourceAsStream()" and reading from the CLASSPATH before I'd ever tell someone to try an absolute path from the file system. What if the file is in a WAR/EAR?
duffymo
There are two same versions of "abc.xml" , one is bundled with "xyz.jar" and other is kept externally( need to know where to keep ? ). I would like to know where to keep the "abc.xml" that isnt bundled , that way I can have the Jboss to see the modifcations ...
Sukhhhh
Yes but the question is asking how to read a file which is hidden by a version which is on the classpath, so if you get a stream via the classloader you will have the wrong file.
Jon Freedman