[jdom-interest] Xalan exception on valid element names... and odd .jar issues/questions

Laurent Bihanic laurent.bihanic at atosorigin.com
Thu Dec 6 01:13:05 PST 2001


Hi,

Mark Bennett wrote:

> 2: Apparently adding a jar to the project path once actually has an affect
> in two places, compile time and runtime.  In hindsight this probably makes
> sense, but not something I was conscious of.


There's a "feature" in javac that makes it ignore the Class-Path entries in 
jar manifests and only consider jars that are actually listed directly in the 
CLASSPATH.
Hence, if you use manifest Class-Path entries (JDOM does), you may not need 
the same CLASSPATH for development and runtime (at least when you are using 
javac).

A bug was raised on javac regarding this behaviour on Sun's Bug Parade but was 
  rejected.


> Some questions I was wondering about:
> * So jdom.jar includes copies of the .class files used by xerces?


No jdom.jar only makes reference to xerces.jar. Thus adding jdom.jar in your 
CLASSPATH automatically makes xerces.jar available (except at compile time, 
see above).


> A concern that I have is reproducing a working environment on a client's
> machine.  In addition to jdom we're using quite a bit of other .jar files
> from other 3rd parties; all of which are redistributable. :)

 >
The guidelines I try to follow are:
  - Install every product cleanly and have the jars reside where the product 
installation program put them.
  - Then, only add to the CLASSPATH the JARs that are listed in the product 
documentation.
  - When a version conflict arises, force the use on one version of a given 
product (e.g. Xerces) by putting its JAR files at the beginning of the CLASSPATH.

When I can't do that (e.g. because I need to wrap all the JARs in a WAR or 
EAR), I copy the JARs, rename them to include product version information 
(e.g. xerces-1.4.3.jar) and update the manifest's Class-Path entries to 
reflect the changes of JAR names and location.

One last thing: It takes few lines of code to develop a tools that looks up a 
class and display where in the CLASSPATH it was found. Get or write one of 
these, they are very useful.

Hope this helps,

Laurent





More information about the jdom-interest mailing list