Java-Tutorials-6-Java Eclipse Overview

What is Eclipse?

In the context of computing, Eclipse is an integrated development environment (IDE) for developing applications using the Java programming language and other programming languages such as C/C++, Python, PERL, Ruby etc.

The Eclipse platform which provides the foundation for the Eclipse IDE is composed of plug-ins and is designed to be extensible using additional plug-ins. Developed using Java, the Eclipse platform can be used to develop rich client applications, integrated development environments and other tools. Eclipse can be used as an IDE for any programming language for which a plug-in is available.

The Java Development Tools (JDT) project provides a plug-in that allows Eclipse to be used as a Java IDE, PyDev is a plugin that allows Eclipse to be used as a Python IDE, C/C++ Development Tools (CDT) is a plug-in that allows Eclipse to be used for developing application using C/C++, the Eclipse Scala plug-in allows Eclipse to be used an IDE to develop Scala applications and PHPeclipse is a plug-in to eclipse that provides complete development tool for PHP.

Eclipse Releases

Every year, since 2006, the Eclipse foundation releases the Eclipse Platform and a number of other plug-ins in June.

Codename Year Platform Version
Callisto 2006 3.2
Europa 2007 3.3
Ganymede 2008 3.4
Galileo 2009 3.5
Helios 2010 3.6
Indigo 2011 3.7
Juno 2012 3.8 and 4.2
Kepler 2013 4.3
Luna 2014 4.4.0

Installation and Set Up Steps?

For Installation and Java Set Up follow Below Link.

http://www.automationfraternity.com/wp_blog/selenium/java-tutorials-7…stallation-steps/

What is a Perspective?

An eclipse perspective is the name given to an initial collection and arrangement of views and an editor area. The default perspective is called java. An eclipse window can have multiple perspectives open in it but only one perspective is active at any point of time. A user can switch between open perspectives or open a new perspective. The active perspective controls what appears in some menus and tool bars.

Opening a Perspective

To open a new perspective, click on the Windows menu and select Open Perspective → Other

 

About Eclipse Workspace

The eclipse workspace contains resources such as −

  • Projects
  • Files
  • Folders

The workspace has a hierarchical structure. Projects are at the top level of the hierarchy and inside them you can have files and folders. Plug-ins use an API provided by the resources plug-in to manage the resources in the workspace.

 

Using the New Java Project wizard

The New Java Project Wizard has two pages. On the first page −

  • Enter the Project Name
  • Select the Java Runtime Environment (JRE) or leave it at the default
  • Select the Project Layout which determines whether there would be a separate folder for the source codes and class files. The recommended option is to create separate folders for sources and class files.

New Java Project

 

Viewing the Newly Created Project

The package explorer shows the newly created Java project. The icon that represents a Project is decorated with a J to show that it is a Java Project. The folder icon is decorated to show that it is a java source folder.

New Java Project Folder Icon

 

Using the New Java Class Wizard

Once the java class wizard comes up −

  • Ensure the source folder and package are correct.
  • Enter the class name.
  • Select the appropriate class modifier.
  • Enter the super class name or click on the Browse button to search for an existing class.
  • Click on the Add button to select the interfaces implemented by this class.
  • Examine and modify the check boxes related to method stubs and comments.

Java Class

  • Click the Finish button.

Viewing the Newly Created Java class

The newly created class should appear in the Package Explorer view and a java editor instance that allows you to modify the new class. It should appear in the editor area.

New Java Class

 

Setting the Java Build Path

The Java build path is used while compiling a Java project to discover dependent classes . It is made up of the following items −

  • Code in the source folders.
  • Jars and classes folder associated with the project.
  • Classes and libraries exported by projects referenced by this project.

The java build path can be seen and modified by using the Java Build Path page of the Java Project properties dialog.

To bring up the Java Project properties dialog box, right click on a Java Project in the Package Explorer view and select the Properties menu item. On the left hand side tree select Java Build Path.

Java Build Path

A common requirement seen while developing java applications is to add existing jars to the java build path. This can be accomplished using the Libraries tab. In the Libraries tab, just click on Add JARs if the jar is already in the Eclipse workspace or click on Add External JARs if the jar is elsewhere in the file system.

 

Opening the Jar File wizard

The Jar File wizard can be used to export the content of a project into a jar file. To bring up the Jar File wizard −

  • In the Package Explorer select the items that you want to export. If you want to export all the classes and resources in the project just select the project.
  • Click on the File menu and select Export.
  • In the filter text box of the first page of the export wizard type in JAR.

Open Jar File Wizard

  • Under the Java category select JAR file.
  • Click on Next.

Using the Jar File wizard

In the JAR File Specification page −

  • Enter the JAR file name and folder.
  • The default is to export only the classes. To export the source code also, click on the Export Java source files and resources check box.

Jar File Specification

  • Click on Next to change the JAR packaging options.
  • Click on Next to change the JAR Manifest specification.
  • Click on Finish.