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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:04:37+00:00 2026-06-07T21:04:37+00:00

So I wrote an ant build.xml file where I take the class files from

  • 0

So I wrote an ant build.xml file where I take the class files from two Java programs, one that extends the other, package them up into two separate jar files, and then, launches them.

<java classname="Main">
             <classpath>
                  <pathelement location="${mainDir}"/>
                  <pathelement path="${Main-Class}"/>
             </classpath>
       </java>

Whenever I invoke ant, it says that “Main” can not be found. I can post the rest of the build.xml file if needed but it’s really just this part that I’m confused about. I’m pretty sure that I have the classname right but my biggest problem is figuring out what goes in for location and path. Right now I just have dummy variables.

EDIT: Here’s the whole file.

<?xml version="1.0"?>
<project default="dist" name="webscarab">
<description>Class</description>
<property name="ClassFiles" location="..\Simple\trunk\dev\Class\bin\" />
<property name="mainClassFiles" location="..\Simple\trunk\dev\main\build\" />
<property name="buildDir" location=".\build" />
<property name="distDir" location=".\dist" />
<property name="mainDir" location="..\Simple\trunk\dev\webscarab\src\" />
<target name="init">
        <tstamp/>
        <mkdir dir="${buildDir}"/>
        <mkdir dir="${distDir}"/>
</target>
<target name="dist" depends="init">
    <jar destfile="${distDir}/package${DSTAMP}.jar" basedir="${ ClassFiles}"/>
    <jar destfile="${distDir}/package-web-${DSTAMP}.jar" basedir="${mainClassFiles}"/>
    <java classname="Main">
     <classpath>
       <pathelement location="${mainDir}"/>
       <pathelement path="${Main-Class}"/>
     </classpath>
   </java>
</target>
</project>

EDIT 2: I should mention everything is already compiled and I have all the .class files. It’s not something I need to do in the Ant file.

  • 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-06-07T21:04:38+00:00Added an answer on June 7, 2026 at 9:04 pm

    The error message about “class cannot be found” is likely due to an incorrect classpath.

    The classpath should grant access to all the class and resource files your application requires. It is composed of a set of directories and jar files. location will denote a single directory or path, whereas path will denote multiple, separated by ; or : depending on your platform.

    In your case, it seems to me that you want your classpath to either consist of ${pegaFuzzClassFiles} and ${webScarabClassFiles} as directories, or of ${distDir}/package-pega-${DSTAMP}.jar and ${distDir}/package-web-${DSTAMP}.jar as jar files. You could do this using a single <pathelement path="…"/> element, but I’d suggest multiple <pathelement location="…"/> as I consider this to be clearer.

    You should also make sure that any third-party libraries used by your application are available on that path as well. You could nest one or more <fileset> into that <classpath>, each of them describing all the jar files in a given directory.

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

Sidebar

Related Questions

I have an ant build system. I have some common build files (common.xml) that
How to write an ant task that removes files from a previously compiled JAR?
Greeting, I'm trying to put some Beanshell script in my Ant build.xml file. I've
I have an ant build file that contains JUnit test suite that I would
I'm new to Ant and wrote up a simple build.xml with some help yesterday.
I've got a ant build.xml that uses the <copy> task to copy a variety
I wrote an app that uses XPath to query some XML config files. When
i need to write an ant (build.xml) file to do the following: - run
I'm trying to write a regular expression for an Ant task that excludes files
I wrote a simple XML file and a DTD file including an entity, but

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.