Unable to access jarfile

I wrote this post while I was working with the Java implementation of Saxon, a collection of tools for processing XML documents, and I bumped in a misleading piece of information while reading Beginning XML (surprisingly, because it is a book that I'd warmly suggest you to read) about executable JARs and their relation with the system CLASSPATH variable.

They say that you should put the Saxon JAR in system CLASSPATH so that you can run it in any folder. But this is not true, if you do it, you get a disappointing error: "Unable to access jarfile".

This is because, as said in the Java documentation about the -jar option: "When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored."

So, you should disregard what written in Beginning XML, and specify the fully qualified named for the executable JAR, something like this:
java -jar \dev\saxon\saxon9he.jar p293.xml p293.xslt

No comments:

Post a Comment