Eclipse IDE


Eclipse Overview
Eclipse an open source community whose projects building tools and frameworks for creating general purpose application.The most popular usage of Eclipse is as a Java development environment.
This tutorial describes the usage of Eclipse as a Java IDE. It describes the installation of Eclipse, the creation of Java programs, the usage of external jars

Getting started
1)Installation:

Download "Eclipse IDE for Java Developers" from the website Eclipse Downloads and unpack it to a directory. This is sufficient for Eclipse to be used; no additional installation procedure is required.

Use a directory path which does not contain spaces in its name.
Eclipse requires an installed Java Runtime. I recommended to use Java 6 (also known as Java 1.6).
Download Page

2) Start Eclipse
To start Eclipse double-click on the file eclipse.exe in your installation directory.

The system will prompt you for a workspace. The workspace is the place there you store your Java projects (more on workspaces later). Select a suitable (empty) directory and press Ok.

Eclipse will start and show the Welcome page.





Eclipse UI Overview:

Eclipse provides perspectives, views and editors. Views and editors are grouped into perspectives. All projects are located in a workspace.
1) Workspace
The workspace is the physical location (file path) you are working in. You can choose the workspace during startup of eclipse or via the menu (File-> Switch Workspace-> Others).
All your projects, sources files, images and other artifacts will be stored and saved in your workspace.
To predefine the workspace you can use the startup parameter -data path_to_workspace, e.g. c:\eclipse.exe -data "c:\temp"Please note that you have to put the path name into brackets. To see the current workspace directory in the title of Eclipse use -showLocation as additional parameter.

2) Perspective
A perspective is a visual container for a set of views and editors.You can change the layout within a perspective (close / open views, editors, change the size, change the position, etc.). A common problem is that you closed a view and don't know how to re-open this view. You can reset a perpective it to it original state via the menu "Window" -> "Reset Perspective".
Eclipse allow you to switch to another perspective via the menu Window->Open Perspective -> Other.For Java development you usually use the "Java Perspective".

3) Views and EditorsEclipse Java IDE - Tutorial
A view is typically used to navigate a hierarchy of information or to open an editor. Changes in a view are directly applied.
Editors are used to modify elements. Editors can have code completion, undo / redo, etc. To apply the changes in an editor to the underlying
resources, e.g. Java source file, you usually have to save.

Create your first Java program
The following will describe how to create a minimal Java program using Eclipse. It will be the classical " Hello World" program. Our program will write  “This is my first Program”  to the console.
1) Create project
Select from the menu File -> New-> Java project. Maintain "HelloWorld" as the project name. Select "Create separate source and output folders".

Press finish to create the project. A new project is created and displayed as a folder. Open the folder "HelloWorld"

4.2. Create package
Create now a package. A good convention is to use the same name for the top package as the project. Create therefore the package "com.src".
Select the folder src, right mouse click on it and select New -> Package




3) Create Java class
Right click on your package and select New -> Class
Create MyFirstProgram, select the flag "public static void main (String[] args)"
Maintain the following code.
                               



                       
Write a simple System.out.print Statement


4) Run your project in Eclipse
Now run your code. There are two ways by which you can run your application.
1)Right click on your Java class and select Run-as-> Java application






2)Click on Run button in your toolbar
Finished! You should see the output in the console.

 
5. Using jars (libraries)
1) Adding external library (.jar ) to the Java classpathEclipse Java IDE - Tutorial
The following describes how to add external jars to your project.
The following assumes you have a jar available.
Right Click on the ProjectàBuild Path -àConfigure Build Path
Select Libraries Tab -->Add External Jars

Select the Jar File you want to add and click Open

The following example shows how the result would look like if ojdbc6.jar would be added to a project.

CONCLUSION
Here we have seen how to install Eclipse IDE and how to run a basic Java program using Eclipse




Comments

Popular posts from this blog

Servlet Advantages and Disadvantages

The Deployment Descriptor: web.xml

Session Management