Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Keeping directory names in jar files

Keeping directory names in jar files

Keeping directory names in jar files

I'm an absolute Ant beginner with a jar task problem. In the past I build my jar files directly in Eclipse, but now I'd like to do the same with Ant. In my project working directory I have 3 subdirectories, which I'd like to add to a single jar file, while keeping the original directory structure.

Directory structure:


Jar-entries as produced by Eclipse Export to Jar file:


Jar-entries that Ant however creates, no matter what I try to do:


This is what my Ant build.xml looks like:

<?xml version="1.0" encoding="UTF-8"?>

<project name="Builder" default="build"

    <target name="build" description="Build the Project jars">
        <jar destfile="resources.jar">
            <fileset dir="config"/>
            <fileset dir="help"/>
            <fileset dir="images"/>

Thanks in advance for your help,


RE: Keeping directory names in jar files

I've found it myself! The problem was caused by the fact that I was adding files at project/subdirectory path level instead of at project path level.

<?xml version="1.0" encoding="UTF-8"?>

<project name="Builder" default="build" basedir=".">

    <target name="build" description="Build the Project jars">
        <jar destfile="resources.jar">
            <fileset dir=".">
                <include name="config/*.*"/>
                <include name="help/*.*"/>
                <include name="images/*.*"/>

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close