Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse `allow output folders for source folders`

Tags:

java

eclipse

When creating a new Java (not JavaEE) project in Eclipse IDE, I see an option that says Allow output folders for source folders.

What is that for?

like image 333
Nam G VU Avatar asked Jun 06 '15 07:06

Nam G VU


People also ask

What is the difference between source folder and folder in eclipse?

A source folder is marked by Eclipse as containing java sources. Then, when you compile your project Eclipse will look for your source code into all your source folders. You can make any folder become a source folder adding it to the java build path.

How do I mark a folder as source in eclipse?

Right-click the "java" directory and select Build Path | Use As Source Folder.

What is default output folder in eclipse?

Eclipse puts binaries in "project folder/bin/" by default.


2 Answers

It allows defining a separate output folder (i.e. the folder where eclipse creates the compiled .class files) per source folder, instead of storing all the .class files of all source folder in the same output folder.

like image 164
JB Nizet Avatar answered Sep 19 '22 17:09

JB Nizet


One little additional hint. I had the same problem, I checked the box, left the dialog and it was unchecked again when I came back.

The solution is very simple, but a little bit hidden for newcomers:

After you have checked that box, you need to open the trees under each of your source folders. You will see a new entry "Output folder" there now, where you can specify individual folders. For instance you keep the output of src/ to go to bin/, but define a specific output folder for test/ (e.g. bin.test/). That way you can grab your real application code from bin/ later (e.g. for putting it in a JAR with an ANT script), but keep bin.test aside.

like image 26
C.Kadura Avatar answered Sep 22 '22 17:09

C.Kadura