Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6244167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:16:40+00:00 2026-05-24T12:16:40+00:00

I have the following tasks in ant: <target name=init-junit depends=init> <mkdir dir=${junit.reports.individual} /> <property

  • 0

I have the following tasks in ant:

<target name="init-junit" depends="init">
    <mkdir dir="${junit.reports.individual}" />
    <property name="running-junit" value="true" />
</target>

<target name="run-tests" depends="init-junit, compile">
    <junit>
        <classpath refid="classpath" />
        <formatter type="xml" />
        <batchtest todir="${junit.reports.individual}">
            <fileset dir="${dir.build}" includes="**/*Test*" />
        </batchtest>
    </junit>
</target>

<target name="compile-reports" depends="run-tests">
    <junitreport todir="${junit.reports}" tofile="junit-report.xml">
        <fileset dir="${junit.reports.individual}" />
        <report format="frames" todir="${junit.reports}/html" />
    </junitreport>
</target>

with ${dir.build} being the directory with all my .class files. The jUnit tests work when I run them in eclipse, but fail when I run them through ant (either run through eclipse or terminal); they each throw the following exception:

org.fscit.{name of class}
    java.lang.ClassNotFoundException: org.fscit.{name of class}
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)

I have junit-4.8.2.jar in my lib folder, which is in the classpath with the id, classpath, and I have build.xml on my project root directory, with its basedir property set to .. Can anyone help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:16:41+00:00Added an answer on May 24, 2026 at 12:16 pm

    You need to have the destination directory of your classes in the classpath. You should have ${dir.build} in your classpath element.

    <path id="classpath">
    <pathelement location="${dir.build}"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following in my build.xml: <target name=compile.baz depends=init> <javac destdir=${build.dir}/classes debug=on> <compilerarg
<target name=init> <mkdir dir=${build.dir} /> <if> <available file=../war type=dir/> <then></then> <else> <mkdir dir=../war />
I have the following ant task: <target name=test> <replace file=test.txt token=smth value=anything/> </target> test.txt
I have following ant mail task - <target name=sendtestreport > <mail mailhost=smtp.com mailport=1025 subject=Test
I have the following task in my MSBuild script: <Target Name=ZipStates> <Message Text=CREATING ZIP
I have the following ant file that is not running the targets prepForDeployment and
I am brand new to Ant. I would like to have the following: <target
I was following these steps - http://maven.apache.org/ant-tasks/examples/dependencies.html and got through. I have a silly
I have the following ant snippet <macrodef name=webapp.start> <attribute name=name /> <sequential> <!--deploy--> <antcall
I have the following in my pom: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ant-plugin</artifactId> <version>2.3</version> <configuration> <target> <echo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.