ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keith Hatton" <>
Subject RE: <java> problem when having xerces in manifest Class-Path. HELP!!
Date Thu, 24 Oct 2002 09:15:45 GMT

My guess would be (and it is only a GUESS) that the <java> tag starts another JVM that
inherits the environment variables of the parent process.

That includes the CLASSPATH variable, which the ant.bat (or whatever) script may fiddle with
first. So, for example, you may have different XML parsers (i.e. whatever is in ANT_HOME/lib)
further up the classpath than those referred to in your manifest file. I've had similar problems
before (not necessarily with Ant) using different versions of the SAX /JAXP libraries to what
I was expecting.

I'd recommend explicitly setting (or un-setting) the classpath in your <java> tag to
see if that fixes the problem.


-----Original Message-----
From: Christian Holmqvist, IT, Posten
Sent: 24 October 2002 09:36
To: 'Ant Users List'
Subject: <java> problem when having xerces in manifest Class-Path.


I have mailed about this once before but since there was no reaction I'll
try again.

It looks like the Class-Path line in the manifest file in a jar is somehow
overridden by ANT.

I have the following manifest file.

Manifest-Version: 1.0
Created-by: Nisse (Posten IT)
Main-Class: se.posten.logistik.applications.taxering.customs.DPDCustoms
Class-Path: xerces-1.3.jar common.jar business.jar

And the following target to execute the application.
  <target name="execute_init" depends="build">
    <property name="exec_loc" value="${temp}/bin"/>
    <property name="prop_file" value="${config}/"/>
    <mkdir dir="${exec_loc}"/>
    <copy file="${common_loc}" todir="${exec_loc}"/>
    <copy file="${business_loc}" todir="${exec_loc}"/>
    <copy file="${xerces13_loc}" todir="${exec_loc}"/>
    <copy file="${jar_file}" todir="${exec_loc}"/>
    <copy file="${prop_file}" todir="${exec_loc}"/>

  <target name="execute" depends="execute_init">
    <java jar="${jar_file}" fork="true">
      <arg value="${prop_file}"/>

As ya'll see all files needed is copied to the bin directory and then the
application is executed with the java command.
As far as I know this should be equal to the java -jar <jar_file> <argument>
command, right?

But when I do and execute everything works fine until the default handler in
xerces is loaded (with reflection i guess), then I get the following
     [java] java.lang.NoClassDefFoundError:
     [java]     at java.lang.ClassLoader.defineClass0(Native Method)
     [java]     at java.lang.ClassLoader.defineClass(
     [java]     at
     [java]     at
     [java]     at$100(
     [java]     at$
     [java]     at
     [java]     at
     [java]     at java.lang.ClassLoader.loadClass(
     [java]     at

     [java]     at java.lang.ClassLoader.loadClass(
     [java]     at

     [java]     at

If I do it without ant i.e. from the command line (java -jar <jar_file>
<argument> in the bin folder everything works just fine.

Has anyone else encountered this problem? Is it a bug in Ant or am I just

Thanks for all your help!

/Christian Holmqvist


Christian Holmqvist

Posten Sverige AB
Posten IT
105 00 Stockholm

Besöksadress: Ekensbergsvägen 113 ,Solna

Tel: 08 - 781 61 48
Mobil: 070 - 985 00 28 

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message