Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to import a project that I'm planning to build upon. The problem is that it is very messy; with source files, class files and libraries under one directory. How would I organise these files using Eclipse?

I know you can change the source folder and output folder, but when I do change the source folder, the files that I want inside it do not physically move to that folder. Output folder is fine, though. Also, I would like a separate folder for libraries. I'm not sure how I would go about this, however.

Here's how I would like it:

src: This folder will contain source files.
bin: This folder will contain binary (class) files.
lib: This folder will contain external libraries.
share|improve this question

1 Answer 1

up vote 1 down vote accepted

I know you can change the source folder and output folder, but when I do change the source folder, the files that I want inside it do not physically move to that folder

You are right: Eclipse won't move those files.

The simplest way to organize those files is to:

  • copy the sources in your 'src' folder.
  • copy the libraries in a 'lib' folder at the same level than src.
  • create an Eclipse project from existing source by selecting the parent directory of 'src' (that will generate your .project and .classpath right above your src directory).
    Don't select the default location (which would create the project in your Eclipse workspace).
  • you should see the lib directory right along src in your project. You can add any jar within it as library.
share|improve this answer
    
The problem is that I have quite a number of sub-folders within the project, which contain source files and class files etc. etc., so copying only the source files that way is troublesome. I guess I could create the project, specify an output folder, which would move the class files out of the way automatically, and then do what you suggested. I'm disappointed that there is no simpler solution, though. Still, what I wanted was some advice from an experienced user, so thanks :). –  someguy Dec 27 '10 at 18:24
    
@someguy: is there any way to quickly clean those subfolder from any non-source files (any non-java files for instance could be deleted, leaving you only with source files) –  VonC Dec 27 '10 at 20:54
    
@VonC I can via NetBeans, but I want to use Eclipse, because I prefer it. I was hoping it would have built-in functions that allowed me to filter files. I know there is inclusion and exclusion, but I don't think it does what I want, and even if it does, I don't quite know how to use it. –  someguy Dec 28 '10 at 15:17
    
@someguy: could you do it (the removal of all extra files) simply through an file explorer, through some search and filtering? That would be quicker. Then you refresh your (Eclipse) project and should be left with only what you need in it. –  VonC Dec 28 '10 at 17:16
    
@VonC I could do that, but it would take a few minutes. Either way, there doesn't appear to be a quick, click-of-a-button solution. –  someguy Dec 29 '10 at 16:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.