Saravanan M
Saravanan M

Reputation: 4747

Specifying .class files as resources and make them copied to output (bin) folder - Eclipse

How to make eclipse treat a directory containing class files as a resource directory and make it copied to the output folder (bin) ?

My project Structure is like this

src
  com
    package1
       all source files (.java)
       image files
    package2
       some dependent class files (.class)
bin
  com
    package1
       generated .class files for source files
       image files
    package2
       (empty)

In eclipse I have specified exculsion filter to exclude the src\com\package2 from source folder list. And I have added the absolute path to src folder in buildpath, so the classes in src\com\package2 are available to build the source files.

Now I want to export the whole set of classes (generated and referenced) into JAR file. For that I need to have the src\com\package2 classes in bin\com\package2 folder which is now empty. Is there any way I can make eclipse treat the class files in src\com\package2 as resource files (like images in src\com\package1) and get them copied to bin\com\package2?

PS: Runnable JAR is not an option as I have so many libraries referenced.

Upvotes: 1

Views: 2799

Answers (1)

Adisesha
Adisesha

Reputation: 5268

Create a new folder in root of project. Move your class files to that folder and add it as a 'class folder' in Java Build path. Now while exporting the jar you can select the class folder and you will get what you want in the jar.

Upvotes: 3

Related Questions