I found that it is usually best not to inherit the Ant runtime environment
configuration when compiling.
I'd recommend building a classpath object that includes the w2c jar and
using that to compile with, while setting the javac task to not inherit the
environment.

ie:

    <path id="compile.classpath">
        <path location="xml-apis.jar"/>
    </path>


    <target name="compile">
            <javac srcdir="src"
                   destdir="classes"
                   classpathref="compile.classpath"
                   includeAntRuntime="false"
                   includeJavaRuntime="false"/>
    </target>


d.


-----Original Message-----
From: Jerry Smith [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 05, 2003 2:23 PM
To: [EMAIL PROTECTED]
Subject: Weird NoClassDefFoundError


Using Ant 1.5.1, Sun JDK 1.4.1_01 with this script:

    <path id="classpath">
        <fileset dir="lib">
            <include name="**/*.jar"/>        
        </fileset>
    </path>

    <target name="build-resources">
        <java   classname="test.MyClass>
            <classpath>
                <path refid="classpath"/>
            </classpath>            
        </java>
    </target>

I get this error:
java.lang.NoClassDefFoundError: org/w3c/dom/Element

It runs from the command line fine with java -cp lib\myjar.jar test.MyClass
Obviously my class does import/use org.w3c.dom.Element

Any ideas on what is happening here?

-Jerry

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to