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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:18:19+00:00 2026-05-25T01:18:19+00:00

I am an Apache Ant novice and I would like to create a build

  • 0

I am an Apache Ant novice and I would like to create a build file with a run task. The run task should execute the following command line statemenet

java -classpath C:/tmp/SYS/doodle.jar;C:/tmp/SYS/CTX.jar sys.ctx.doodle.Start

where the sys.ctx.doodle.Start class is located in the doodle.jar

My question is: how can I add two elements in a classpath?
I have tried the following:

<target name="run">
   <java jar="C:/tmp/SYS/doodle.jar" fork="true">
  <classpath>
      <pathelement location="C:/tmp/SYS/doodle.jar"/>
      <pathelement path="sys.ctx.doodle.Start"/>
  </classpath>
  <classpath>   
       <pathelement location="C:/tmp/SYS/CTX.jar"/>
  </classpath>
   </java>
</target>

But when executing it throws me a java.lang.NoClassDefFoundError

Any idea where the problem may be?

  • 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-25T01:18:19+00:00Added an answer on May 25, 2026 at 1:18 am

    You can transpose your command-line path into the Ant java task classpath attribute directly. Ant should take care of recognising that is composed of semicolon-delimited jar names.

    <java classpath="C:/tmp/SYS/doodle.jar;C:/tmp/SYS/CTX.jar" ... >
    

    Or you can specify it as a nested element as you currently have:

    <java ... >
        <classpath>
            <pathelement path="C:/tmp/SYS/doodle.jar;C:/tmp/SYS/CTX.jar" />
        </classpath>
    </java>
    

    The argument sys.ctx.doodle.Start looks like the name of the class you want to run. Use the classname attribute to pass that to the java task. Putting that with the classpath leads to:

    <java classpath="C:/tmp/SYS/doodle.jar;C:/tmp/SYS/CTX.jar"
          classname="sys.ctx.doodle.Start" />
    

    The jar attribute should be used only when you want to run the Main-Class included in that jar.

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

Sidebar

Related Questions

I have an Apache Ant build file with a <javac> command that requires four
I have created a Java application which has the following Apache Ant build file:
I need to modify a (xml-)file from Apache Ant. loadfile task allows to load
I have installed ant(apache-ant-1.7.0). But when i run the ant command in dos command
I've got the following build environment : Ubuntu Java 1.6.0_24 Apache ant 1.8.2 Jenkins
Is it possible to execute Apache Ant build tool in a validation ode? e.g
I'm trying to run junitreport task in Ant in Ant in Maven: <plugin> <groupId>org.apache.maven.plugins</groupId>
I would like to build two versions of my Android application using an Apache
I've written an Ant build.xml file which obtains a number of source files via
I'm trying to create 2 zip files as part of an ant task. Both

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.