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 6808607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:58:37+00:00 2026-05-26T19:58:37+00:00

I am using Eclipse Indigo. Not sure what is going on, but what I

  • 0

I am using Eclipse Indigo. Not sure what is going on, but what I try to invoke the test suite from an ant build I get a ClassNotFoundException. However, if I right click on the JUnit Test class and run as Junit Test, it runs the tests fine. The error says that the file ./test/_ObservableSortUnitTests is not found. It gives the same error even if I give a full path to the file.

Here is my error:

Buildfile: /home/jason/Dev/ObservableSort/build.xml
Compile:
Test:
    [junit] Testsuite: ./test/_ObservableSortUnitTests
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    [junit]     Caused an ERROR
    [junit] ./test/_ObservableSortUnitTests
    [junit] java.lang.ClassNotFoundException: ./test/_ObservableSortUnitTests
    [junit]     at java.lang.Class.forName0(Native Method)
    [junit]     at java.lang.Class.forName(Class.java:264)
    [junit]     at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
    [junit]     at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
    [junit]     at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)

BUILD FAILED
/home/jason/Dev/ObservableSort/build.xml:75: Test ./test/_ObservableSortUnitTests failed

Total time: 1 second

Here is my ant script (disclaimer: I am very new to ant):

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="Build" name="CS 151 Project Build Script" >
    <!--ANT 1.7 is required  -->
    <property name="home" value="." />                
    <property name="src.dir" value = "${home}/src" />
    <property name="dest.dir" value="${home}/Release" />
    <property name="dir.build" value="${home}/lib" />
    <property name="dir.javadoc" value="${dest.dir}/Javadoc" />
    <property name="dir.classes" value="${dest.dir}/Classes" />
    <property name="dir.junit.reports" value="${dest.dir}/Reports" />
    <property name="test.suite.dir" value="${home}/test" />
    <property name="test.suite.class" value ="${test.suite.dir}/_ObservableSortUnitTests" />

    <path id="build.class.path">
        <fileset dir="${dir.build}">
            <include name="*.jar" />
        </fileset>
    </path> 

    <path id="test.class.path">
        <pathelement location="${junit.test.suite}" />
    </path>

    <target name="Clean" description="Deletes all old files">
        <delete dir="${dir.javadoc}" />
        <delete dir="${dir.classes}" />
        <delete dir="${dir.junit.reports}" />
    </target>

    <target name="Prepare" description="Creates all necessary directories">
        <mkdir dir="${dir.javadoc}" />
        <mkdir dir="${dir.classes}" />
        <mkdir dir="${dir.junit.reports}" />
    </target>   

    <target name="Compile">
        <javac srcdir="${src.dir}" destdir="${dir.classes}" includeantruntime="true">
            <classpath refid="build.class.path" />
        </javac>
    </target>

    <target name="Full" description="Executes all build targets">
        <antcall target="Clean" />
        <antcall target="Prepare" />
        <antcall target="Compile" />
        <antcall target="Test" />
        <antcall target="Build" />
        <antcall target="Javadoc" />
        <antcall target="run" />
    </target>

    <target name="Build" description="Creates executable jar" depends="Clean, Prepare, Compile">
        <jar destfile="${dest.dir}/ObservableSort.jar" filesetmanifest="mergewithoutmain">
            <manifest>
                <attribute name="Main-Class" value="cs151.project1.ObservableSortTest"/>
                <attribute name="Class-Path" value="."/>
            </manifest>
            <fileset dir="${home}/bin"/>
        </jar>
    </target>

    <target name="Run" depends="Compile, Build">
        <java jar="${dest.dir}/ObservableSort.jar" fork="true" />
    </target>           

    <target name="Run with Unit Tests" depends="Compile, Build, Test">
        <java jar="${dest.dir}/ObservableSort.jar" fork="true" />
    </target>

    <target name="Javadoc" description="Generate Javadoc" depends="Compile" >
        <javadoc access="public" author="true"  destdir="${dir.javadoc}" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="cs151.project1.sorters.insertionsort,cs151.project1.sorters.selectionsort,cs151.project1.Quantifiable,cs151.project1,cs151.project1.sorters.quicksort,cs151.project1.views" source="1.6" sourcepath="${src.dir}" splitindex="false" use="true" version="true"/>
    </target>

    <target name="Test" depends="Compile">
        <junit>
            <classpath refid="build.class.path" />
            <classpath refid="test.class.path" />
            <formatter type="plain" usefile="false" />
            <test name="${test.suite.class}" haltonerror="true" />
        </junit>
    </target>
</project>
  • 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-26T19:58:38+00:00Added an answer on May 26, 2026 at 7:58 pm

    Stupid mistake: The JUnit classes were not yet compiled.

    Solution:

    • Compile the project into a directory X
    • Compile the JUnit classes into a directory Y
    • Add the JUnit jar to directory Z

    Inside the < test > tag, add directories X, Y, and Z to the classpath.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am exporting my project using Eclipse indigo which earlier was working fine but
Using Eclipse Indigo and Birt downloaded from the default update site on Ubuntu 11.10
I am using Eclipse Indigo. When I try to contact http://download.jboss.org/jbosstools/updates/development/indigo/ Installing updates result
When using Eclipse or NetBeans IDE on a Java project I get to see
I've been using Eclipse with RDT (not RadRails) a lot lately, and I'm quite
I am using Eclipse RCP to build desktop app. When the user invokes a
I'm using m2e (1.0.100), Eclipse (Indigo SR1) and hibernate-jpamodelgen (1.1.1.Final). I want to have
I am using Eclipse Indigo and Subversive SVN Team provider. While i was generating
I am using Redhat linux 32bit version. installed eclipse indigo 32 bit version. when
I am using Eclipse Indigo RC4 with EGit (bundled). I have a project which

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.