Eclipse Tutorial Part 1: Eclipse Project Framework
By: admin - Tuesday, September 9th, 2008 at 11:54 am“Science is organized knowledge. Wisdom is organized life.” Immanuel Kant.
In the Eclipse environment, every file is stored inside a project. This means that every document, folder, code file (.java) and compiled code (.class) has to be contained by a project. So, the first step before programming using Eclipse is to understand the Eclipse project framework.
It is necessary to create a new project to develop a new Java program, but also to edit existing code (i.e., a .java file stored inside a diskette). To create a new project select from the main menu line “File > New > Project …”. You may also select “New > Project …” by right clicking any point of the package explorer window.

There are various kinds of Eclipse projects that you may create:
* To create or edit Java programs, a Java project should be create. Notice that a Java project can also store program related information, such as code documentation and other related files.
* Simple projects should only be created to store documents and other files with no Java code.
* Plug-in Development projects are used to add new modules and facilities to the Eclipse environment. You will only want to use these projects if you become a Eclipse developer.
* Eclipse Modelling Framework projects are used to create analysis and design models.
As this tutorial focuses on using Eclipse to develop Java programs, you should create a new Java project. So, select “Java > Java Project” and click the “Next >” button of the creation wizard.

After this, you should specify a new name for your project. Professional projects usually are named using inverted domain names, to avoid name collisions. If your project is for internal usage only, you may name it as you wish. In this example we have called the new project “Eclipse Tutorial”.
Using the default directory, the project contents will be stored under the “[EclipseInstallDirectory]\workspace\[ProjectName]\” directory. You may also specify a different directory to store these contents.

Besides you could end creating the new project by clicking the “Finish” button, you should better click the “Next >” button again. This way, you could define a source folder for your Java project from the very beginning. Source folders are the folders that store the Java source code files (the .java files). By placing your Java files inside a source folder, they will be automatically compiled.

To create this source folder select the “Source” tab and click the “Add Folder…” button. Select your recently created project and click the “Create New Folder” button. A good name for this source folder may be just “src”. After specifying such folder name, click “Ok”. You should answer yes to the appearing question prompt in order to update the Eclipse build output folder to “\bin”. So, the compiled code (.class files) will be stored inside the “bin” folder. Click the “Finish” button in order to end the project creation process.

Your recently created project should look like this, as shown in the “Navigator” view.
In Eclipse 3.0 the project creation wizard is somehow different from Eclipse 2.x. It is still possible creating Eclipse projects in a user defined location. But now, every previously explained step to create an appropriate folder structure may be omitted. Just select the “Create separate source and output folders” option to automatically construct the desired folder structure.

As mentioned before, to edit an already existing element it should be imported inside a project. This can be done from the “File > Import…” menu, or by right clicking any point of the package explorer or the navigator and selecting “Import…”. To select a file or a directory of your computer select “File system” in the import sub menu. Then you will only have to browse a directory, check the desired files and folders and make sure that the folder in which those files will be copied is your appropriate Eclipse project.
![]()
Notice that every imported element is duplicated. This means that you may delete the copy of these files that Eclipse manages, and still have your original file. Nevertheless, when importing an existing Eclipse project, the project contents will not be duplicated. So, be specially careful when deleting from your Eclipse workspace those Eclipse imported projects, as no other copies may exist.
The files created using Eclipse may also be exported as normal files (File system), Java Jar files and even Zip files. This is achieved through a process similar to the importing process already detailed, selecting the “Export” option.
![]()
It is also possible copying, cutting and pasting files and folders from Eclipse to your file system (i.e., Windows explorer) and vice versa (i.e., selecting a file, pressing CTRL+C, then choosing a destination folder and pressing CTRL+V).
iEntry 10th Anniversary
Java Faqs