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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:51:47+00:00 2026-05-29T20:51:47+00:00

I have a Eclipse-Java-Project with an ANT-build-file. This build file exports a jar of

  • 0

I have a Eclipse-Java-Project with an ANT-build-file. This build file exports a jar of the project without compiling it. So I only export the sources.

<target name="jar">
    <mkdir dir="/jar"/>
    <jar destfile="/jar/my_test_jarfile.jar" basedir="/src" />
</target>

I use this generated jar in another eclipse java project and set the path to the jar in the build-path-settings of the project. The problem is that eclipse says it cannot resolve the namespace of the imported classes of the jar.
If I export the jar manually by right clicking on the project and then “Export” and putting the jar to the build path of the other project, everything works fine and there are no errors. So the question is now, what am I doing wrong?

  • 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-29T20:51:49+00:00Added an answer on May 29, 2026 at 8:51 pm

    So here is my solution. It seems that you have to compile the source first and then pack it into a jar. I don’t give a guarantee that this jar is exactly the same like the one you get from eclipse when you do the right click thing and export etc.
    But it works for me, there are no namespace errors any longer. so here is a minimum version of my ant targets:

    <project default="run" basedir=".">
        <property name="src.dir" value="src" />
        <property name="classes.dir" value="bin" />
        <property name="build.dir" value="build" />
    
        <path id="libs">
            <fileset dir="lib">
                <include name="*.jar"/>
            </fileset>
            <pathelement path="${basedir}\${classes.dir}"/>
        </path>
    
        <target name="run">
            <antcall target="compile"/>
            <antcall target="jar"/>
        </target>
    
        <target name="compile">
            <javac debug="true" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="libs" encoding="UTF-8" />
        </target>
    
        <target name="jar">
            <jar destfile="${build.dir}/my_jar_file.jar" basedir="${classes.dir}"> 
        </target>
    </project>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a java project with a ant build file, using this ant
We have a Java application and a supporting Ant build.xml file, and the team
I have a Java EE project which build fine with Ant, deploys perfectly to
I have the following setup: eclipse a standard Java project (A) an eclipse plugin
I have a Java project in Eclipse with ~10 packages and ~10 class files
Have anyone successfully managed to setup a combined Java/C++ project for Eclipse? What I
I have recently created a web project in Java using eclipse. I have a
This is a question from a Java noob. I have eclipse open (JRE 1.6),
I am trying to build my Android project with Ant. Whenever I use Eclipse
We have an ant build script for a project we're developing for a PDA.

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.