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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:22:26+00:00 2026-06-09T05:22:26+00:00

I have following ant script to generate the jar file <project name=myProject basedir=. default=jar>

  • 0

I have following ant script to generate the jar file

<project name="myProject" basedir="." default="jar">
<property name="src" value="Java Source"/>
<property name="output" value="bin"/>

<target name="compile" depends="create">
    <javac destdir="bin">
        <src path="${src}"/>
        <classpath refid="myProject.classpath"/>
    </javac>
</target>

<target name="jar" depends="compile">
    <jar destfile="myProject.jar">
        <fileset dir="bin"/>
    </jar>
</target>


<target name="clean">
    <delete dir="${output}"/>
</target>

<target name="create" depends="clean">
    <mkdir dir="${output}"/>
</target>

When I run ant script i get following error

Reference myProject.classpath not found.

I am not sure how to solve this error. It requires path of .classpath file ?
I also tried with

refid=”classpath”

and it didnt work.

Can anyone help please!
Thanks

  • 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-09T05:22:27+00:00Added an answer on June 9, 2026 at 5:22 am

    You need to define first something like because right now MyProject.classpath is not defined:

    <classpath>
      <pathelement path="${classpath}"/>
    </classpath>
    

    assuming that your classpath has what you need.

    If it does not, create another entry under classpath element that has references to jars or whatever you need, or you need to custom specify path:

      <path id="MyProject.classpath">
       <pathelement location="lib/"/>
       <pathelement path="${classpath}/"/>
       <pathelement path="${additional.path}"/>
      </path>
    

    http://ant.apache.org/manual/using.html#path

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

Sidebar

Related Questions

I have following ant file to build. But unfortunately <project default=build.deploy.start basedir=.> <property name=target.dir
I have an ant script with the following header: <project name=Simple ActiveJDBC Example default=clean
I have the following Ant build file: <?xml version=1.0 encoding=UTF-8?> <project default=build name=MyAntScript> <!--
i have the following code snippet in my ANT File which compiles my project
I have following script which is aim to make a war file. def ant
i have the following Ant script for reading revisionlog.txt file line by line and
I have the following section to print the ant build info into a file.
I have the following use case: My application is started with an Ant Script,
The ANT build script I have does the following: Perform the builds on Windows
I have the following ant script that I can't seem to find a way

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.