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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:57:13+00:00 2026-05-20T07:57:13+00:00

I have written few test scripts using JUnit 4 and Selenium. I have added

  • 0

I have written few test scripts using JUnit 4 and Selenium.
I have added the jar files for JUnit and Selenium to eclipse and if I run my tests through eclipse IDE everything is working as expected.

I am now trying to run these tests through the ant script below:

<project name="JUnit" default="test">

    <property name="src" value="./src" />
    <property name="classes" value="./classes" />
    <property name="test.class.name" value="AllTests" />

    <path id="test.classpath">
      <pathelement location="${classes}" />
      <pathelement location="C:/Program Files/eclipse 3.5/plugins/org.junit4_4.5.0.v20090824/junit.jar" />
      <pathelement location="C:/selenium/selenium-server-standalone-2.0b2.jar" />
      <pathelement location="C:/Program Files/eclipse 3.5/plugins/org.hamcrest.core_1.1.0.v20090501071000.jar" />
    </path>

    <target name="test">
      <junit fork="yes" haltonfailure="yes">
        <test name="${test.class.name}" />
        <formatter type="plain" usefile="false" />
        <classpath refid="test.classpath" />
      </junit>
    </target>

</project>

The problem is that when I run this ant script I am getting the following Exception:

[junit] java.lang.ClassNotFoundException: AllTests
[junit]     at java.net.URLClassLoader$1.run(Unknown Source)
[junit]     at java.security.AccessController.doPrivileged(Native Method)
[junit]     at java.net.URLClassLoader.findClass(Unknown Source)
[junit]     at java.lang.ClassLoader.loadClass(Unknown Source)
[junit]     at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[junit]     at java.lang.ClassLoader.loadClass(Unknown Source)
[junit]     at java.lang.Class.forName0(Native Method)
[junit]     at java.lang.Class.forName(Unknown Source)

I have added all the jar files that I see in eclipse .classpath file so a bit confused of which files I am missing.

  • 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-20T07:57:14+00:00Added an answer on May 20, 2026 at 7:57 am

    Found the problem, stupid one but I guess it was lack of concentration…
    My .class files are in the ./bin folder and the ant script was pointing to ./classes.
    I copied it from an old ant script I’ve been using and didn’t take notice of the properties configured.

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

Sidebar

Related Questions

I was going through a few tests written in Java using JUnit and I
I have just written a few unit tests and to my horror it failed.
I have written a C library which consists in a few .h files and
I have written a few MSBuild custom tasks that work well and are use
I have written a few modules of code in Access vba. Each code runs
I have written a few Python tools in the past to extract data from
I have written a service that monitors a file drop location for files from
I'm using NetBeans and GlassFish 3.0.1 to create an EJB3 application. I have written
I have written an AIR Application that downloads videos and documents from a server.
I have written some code in my VB.NET application to send an HTML e-mail

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.