Tuesday, July 31, 2012

How to Organize Eclipse Java Project Structure

This post aims to cover the folder structure you can maintain. Organized folder structures and projects are required for a smoother execution and debugging. Here I will try to explain the way I organize the folder structure of my projects.

Contents:
Please note that others way of organizing the project folder structure might be different than of mine. Users are requested to make a fair judgement of what is required by searching more in internet and proceed accordingly.

Folder Structure

To create a folder in eclipse, you right click on the project you want to create the folder structure and select folder to create a new folder as below.

Select Folder in New > Right click menu on Eclipse Project.

Create a folder with a name as required.
Create a new folder with name
Create a new folder with Folder name 

src

This folder is a place holder of your java packages and classes. Typically all your .java files sit in this folder.

bin

This folder holds the compiled .class files. Eclipse will automatically compile all the .java files in your source code to .class files and store them in bin folder under your project structure in workspace. This folder will not be displayed in your eclipse structure but will be present in the path. holding all the incrementally compiled java files.

build

This folder will hold the .class files compiled by ANT from .java files. I will leave the bin folder maintained by eclipse to track .class files by itself. build folder will be actually the folder that will hold my .class files compiled by our own specific set of compilation flags and setting if any.

dist

This folder should hold your deliverable's like jars which you intend to deliver and distribute.

lib

This folder holds the external libraries which you intend to use in your project.


Apart from the above folder structure, user can create other folders catering to the needs of a particular project or product. The end project structure should look something similar to what is shown below.

Final Folder structure in Eclipse project.
This is how your folder structure should look like.

Be the first to comment on this post

Post a Comment