Reading:  

Beginners guide to Eclipse IDE


Creating your first project

To create a new java project the New Java Project wizard is used. In many ways we can open wizard:

  • Go to File menu and click New select Java Project
  • Click New button( ) in the tool bar and select Java Project
  • Right click anywhere in the Project Explorer and click New select Java Project

New Java Project wizard:

The Wizard has two stages.

The first stage:

  • Project Name need to be enter and if user want to change the workspace from default.
  • User can select the Java Runtime Environment (JRE) or leave it at the default
  • By default option is to create separate folders for class and sources files. Or User can select use project folder as root class and sources files.
  • Click on the Finish button to create the project

    Eclipse: create a project

The second stage:

If there are multiple projects user needs to add additional jars to build path hence user click on Next button instead of finish, to change the Java Build Setting. Java Build Setting is used while compiling a Java project to discover dependent classes.

The Java build path has the following items:

  • The source folders code
  • The project associated with Jars and classes folder
  • Classes and libraries exported by projects referenced by this project

To open Java Project properties dialog box, right click on a Java Project and select the Properties on the left hand side tree select Java Build Path.

Eclipse Java Project properties

In the Libraries tab, click Add JARs if the jar is in the workspace of eclipse or click Add External JARs if the jar is not in the workspace of eclipse.

 

The newly created project

The newly created Java project is shown in the package explorer. The Java Project is represented by an icon with a "J".

Eclipse package explorer

 

Create Java Package

User can create a Java package by using New Java Package wizard. In many ways wizard can be opened:

  • Go to File and click New select Package
  • Click package icon eclipse package icon  in the tool bar
  • Right click in the package explorer and click New select Package

To create a sub package, right clicks on parent package and select package.

The New Java Package wizard

The Java Package wizard opens:

  • Enter the name of source folder
  • Package name should enter
  • Click Finish button.

Java Package wizard Eclipse

 

The newly created package:

The newly created package under the source folder is shown in the package explorer.

New package eclipse

 

Eclipse - Create Java Class                 

User can create Java class by using the New Java Class wizard. In many ways wizard can be opened:

  • Go to File and click New select Class
  • Click class drop down button ( ) and choose class ( )
  • Right click in the package explorer and click New select Class

Right click on package in which class is to be created so that wizard can automatically take package name.

The New Java Class wizard

The java class wizard opens:

  • Make sure source folder and package are correct
  • class name should be enter
  • Select class modifier
  • Super class name should be enter or can search for an existing class by clicking Browse button
  • Click Finish button

Eclipse New Java Class wizard

The newly created java class

The newly created class under the source folder is shown in package explorer

eclipse: newly created class under the source folder

Create Java Interface

User can create Java interface by using the New Java Interface wizard. In many ways wizard can be opened:

  • Go to File and click New select Interface
  • Click class drop down button ( ) and choose Interface ( )
  • Right click in the package explorer and click New select Interface

Right click on package in which the interface is to be created so that the wizard can automatically takes the package name.

The New Java Interface wizard

The java interface wizard opens:

  • Make sure the source folder and package are correct
  • Interface name should be enter
  • To select interfaces and it should extend click on Add button
  • If you like to generate comments select the Generate comments check box
  • Click Finish button

eclipse: New Java Interface wizard

 

The newly created java interface

The newly created interface under source folder is shown in package explorer

java interface

 

Create XML File

User can create XML file by using New XML wizard. In many ways wizard can be opened:

  • Go to File and click New select Other…
  • By using short keys Press ctrl + N
  • Click class drop down button ( ) and choose Other

Right click on package in which XML file is to be created so that wizard can automatically take package name.

The Select a wizard dialog box opens:

  • Enter xml to the filter text box, show only the wizards related to xml
  • Expand XML and click XML File
  • Click Next button

Create XML File: Eclipse

The New XML File wizard

The New XML File wizard opens:

  • select the parent folder
  • the xml file name should be enter

New XML File wizard - Eclipse

The newly created XML File

The newly created xml file under the source folder is shown in the package explorer.

Eclipse: XML File

 

In next part of this tutorial, we will talk about run configurations.

Description

This guide is focused on people who want to get started with Eclipse IDE. This guide has several chapters as shown below

  • What is Eclipse IDE and How to install Eclipse IDE
  • Exploring Windows
  • Working with Workspaces
  • Create your first Project
  • Run Configuration
  • How to export projects to Jar Files
  • How to Close Project
  • Debug Configuration
  • Setting Preferences
  • CodeAssist
  • Quick Fix
  • Hover Help
  • Navigation
  • Refactoring
  • Add Bookmarks
  • Installing Plugins
  • Code Templates
  • Shortcuts and Restart Option
  • Inbuilt Browser

Please forward your feedback on corrections or if you think a section can be improved. 

 



Audience

Students looking for a quick introduction to Eclipse IDE

Learning Objectives

Learn Eclipse

Author: Subject Coach
Added on: 19th Mar 2015

You must be logged in as Student to ask a Question.

None just yet!