Reputation: 856
I need to maintain/install the following java code:
javax.xml.transform.Transformer t =
tf.newTransformer(new javax.xml.transform.stream.StreamSource("foo.xsl")) ;
Where does the foo.xsl file need to reside in order to be found ?
Upvotes: 0
Views: 727
Reputation: 30248
That would be relative to the current directory of the JVM process. Kind of "where you were standing" when you've started the JVM.
Upvotes: 1
Reputation: 68887
In OS X and Windows, this is normally the folder containing the JAR file.
In Linux, it might be the user home directory? If it isn't the home dir, it will be the same as in OS X and Windows. So be careful with it in Linux.
Upvotes: -1
Reputation: 28697
This will use the current working directory of the application.
Your best bet is to load it as a resource out of the classpath instead, which means that you can place the .xsl file in your application JAR, etc.
I have some existing documentation around this on my own blog. See "6. XSLT Inheritance" at http://blogger.ziesemer.com/2009/01/xml-and-xslt-tips-and-tricks-for-java.html.
Upvotes: 2