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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:10:19+00:00 2026-06-03T05:10:19+00:00

I have a Java project with all source files in the src folder. This

  • 0

I have a Java project with all source files in the src folder. This src folder contains several packages. Some of these packages/folders do not include any Java code. They just contain some images that I use in the application as icons.

The directory structure is similar to the following.

src/
com/
   example/
       pk1/     # This contains only some Java files.
       pk2/     # This will contain some XML and Java code.
       im1/     # This subfolder will contain just the images

Now, when I use the javac task, it compiles all the Java files into class files and stores them in the destination directory that I specify. However, an non-java files remain as is in the source folder.

I referred this Question on SO. However, I think in my case I want to include all non-Java resource files (without the need to explicitly specifying what files to be moved) automatically into the build directory (one that contains all the class files) while following the same directory structure as in source.

Pardon me if I am missing something very trivial, but how do I ask Ant to do this?

  • 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-03T05:10:20+00:00Added an answer on June 3, 2026 at 5:10 am

    Use the ant copy task to copy your resources into the classes directory (or wherever your .class files are stored). By default, ant keeps the directory structure.

    For example:

    <copy todir="classes">
      <fileset dir="com/example">
        <exclude name="**/*.java"/>
      </fileset>
    </copy>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a grails project with some additional java source files under src/java folder.
I have a Java project in Eclipse with ~10 packages and ~10 class files
I have a project set up like this; Project -src -com -top -classes Class_3.java
I have a project with a linked source folder. This project depends on another
I have a java project. The working folder from someone else's Eclipse project (It
I have an Eclipse project with the following directory structure: MyProj >> src/main/java >>
In my project, I have a resources directory ( src/main/resources ) that contains properties
In my SVN java source files are under src/java/com/... location. When I create the
I work on an open-source Java project, and we have a lot of resource
I have just set up a new Eclipse Java project. In this project I

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.