ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keith Hatton" <khat...@axiomsystems.com>
Subject RE: JUnit and bootclasspath
Date Mon, 20 Jan 2003 16:52:39 GMT
You also need

JAVA_HOME/jre/lib/rt.jar
JAVA_HOME/jre/lib/i18n.jar (if you have the international JRE)

Alternatively, use the -Xbootclasspath/p:<your-libraries> switch instead to prepend
your libraries to the boot classpath instead of replacing it completely. (But see Java docs
for use of "-X" -style switches).

Keith


-----Original Message-----
From: William E. Kempf [mailto:wekempf@cox.net]
Sent: 21 January 2003 06:55
To: ant-user@jakarta.apache.org
Subject: Re: JUnit and bootclasspath


Stefan Bodewig said:
> On Fri, 17 Jan 2003, William E. Kempf <wekempf@cox.net> wrote:
>
>>> If you are forking <junit>, you could specify the -bootclasspath
>>> option as <jvmarg>.  Adding <bootclasspath> to side <classpath>
to
>>> the JUnit task could be a very valid enhancement request.
>>
>> Part of my question is how to use a classpathref here.
>
> <property name="path.as.property" refid="your-ref"/>
> <junit fork="true"...>
>   ...
>   <jvmarg value="-Xbootclasspath:${path.as.property}"/>
> </junit>

OK, this is probably now much more of a general Java question than Ant
related, but since it has to do with the original question and answer...

Here's how I supply the bootclasspath:

<property name="bootclasspath" refid="mylib.classpath" />
<junit printsummary="no"
       errorProperty="test.failed"
       failureProperty="test.failed"
       fork="yes">
        <classpath refid="mylib.classpath"/>
        <jvmarg value="-Xbootclasspath:${bootclasspath}" />
        <sysproperty key="docs.dir" value="${junit.data.dir}" />
        <sysproperty key="index.dir" value="${junit.data.dir}/index" />
        <formatter type="xml" />
        <formatter type="brief" usefile="false" />
        <test name="${testcase}" if="testcase" />
        <batchtest todir="${junit.data.dir}" unless="testcase">
                <fileset dir="${build.dir}" includes="**/*Test.class" />
        </batchtest>
</junit>

And the result is:

    [junit] Error occurred during initialization of VM
    [junit] java/lang/NoClassDefFoundError: java/lang/Object
    [junit] TEST test.com.mylib.swing.DefaultMyJButtonTest FAILED

So, obviously setting the bootclasspath has issues, since it now doesn't
contain the normal path elements.  But what are the normal bootclasspath
elements?





--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message