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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:54:11+00:00 2026-05-11T02:54:11+00:00

I’m trying to run my junit tests using ant. The tests are kicked off

  • 0

I’m trying to run my junit tests using ant. The tests are kicked off using a JUnit 4 test suite. If I run this direct from Eclipse the tests complete without error. However if I run it from ant then many of the tests fail with this error repeated over and over until the junit task crashes.

     [junit] java.util.zip.ZipException: error in opening zip file     [junit]     at java.util.zip.ZipFile.open(Native Method)     [junit]     at java.util.zip.ZipFile.(ZipFile.java:114)     [junit]     at java.util.zip.ZipFile.(ZipFile.java:131)     [junit]     at org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLoader.java:1028)     [junit]     at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.findNextResource(AntClassLoader.java:147)     [junit]     at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.nextElement(AntClassLoader.java:130)     [junit]     at org.apache.tools.ant.util.CollectionUtils$CompoundEnumeration.nextElement(CollectionUtils.java:198)     [junit]     at sun.misc.CompoundEnumeration.nextElement(CompoundEnumeration.java:43)     [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.checkForkedPath(JUnitTask.java:1128)     [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(JUnitTask.java:1013)     [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:834)     [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:1785)     [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:785)     [junit]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)     [junit]     at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)     [junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)     [junit]     at java.lang.reflect.Method.invoke(Method.java:597)     [junit]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)     [junit]     at org.apache.tools.ant.Task.perform(Task.java:348)     [junit]     at org.apache.tools.ant.Target.execute(Target.java:357)     [junit]     at org.apache.tools.ant.Target.performTasks(Target.java:385)     [junit]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)     [junit]     at org.apache.tools.ant.Project.executeTarget(Project.java:1306)     [junit]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)     [junit]     at org.apache.tools.ant.Project.executeTargets(Project.java:1189)     [junit]     at org.apache.tools.ant.Main.runBuild(Main.java:758)     [junit]     at org.apache.tools.ant.Main.startAnt(Main.java:217)     [junit]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)     [junit]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)  

my test running task is as follows:

     <target name="run-junit-tests" depends="compile-tests,clean-results">         <mkdir dir="${test.results.dir}"/>         <junit failureproperty="tests.failed" fork="true" showoutput="yes" includeantruntime="false">             <classpath refid="test.run.path" />             <formatter type="xml" />             <test name="project.AllTests" todir="${basedir}/test-results" />         </junit>         <fail if="tests.failed" message="Unit tests failed"/>     </target> 

I’ve verified that the classpath contains the following as well as all of the program code and libraries:

 ant-junit.jar ant-launcher.jar ant.jar easymock.jar easymockclassextension.jar junit-4.4.jar

I’ve tried debugging to find out which ZipFile it is trying to open with no luck, I’ve tried toggling includeantruntime and fork and i’ve tried running ant with ant -lib test/libs where test/libs contains the ant and junit libraries.

Any info about what causes this exception or how you’ve configured ant to successfully run unit tests is gratefully received.

ant 1.7.1 (ubuntu), java 1.6.0_10, junit 4.4

Thanks.

Update – Fixed Found my problem. I had included my classes directory in my path using a fileset as opposed to a pathelement this was causing .class files to be opened as ZipFiles which of course threw an exception.

  • 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. 2026-05-11T02:54:11+00:00Added an answer on May 11, 2026 at 2:54 am

    Found my problem. I had included my classes directory in my path using a fileset as opposed to a pathelement this was causing .class files to be opened as ZipFiles which of course threw an exception.

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

Sidebar

Ask A Question

Stats

  • Questions 122k
  • Answers 122k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm guessing that the flags field is actually set to… May 12, 2026 at 12:38 am
  • Editorial Team
    Editorial Team added an answer Instead of scanf("%d\n", &bet); do scanf("%d", &bet); Just tested and… May 12, 2026 at 12:38 am
  • Editorial Team
    Editorial Team added an answer Scott Hanselman has a blog post regarding Visual Studio Themes… May 12, 2026 at 12:38 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.