How To Eclipse Configuration For Java

In this Post, We will see how to do Eclipse Configuration in Java, how to write first Java program, how to run it and various shortcut Keys which is useful while writing Java programming.

Eclipse Configuration:

1.You can start eclipse by double clicking of “eclipse.exe” (where you save eclipse setup folder)

(No need to install eclipse)

Download Eclipse from Here. Download Page

2. When eclipse start up for the first time it will open Workspace launcher window for the location of the workspace folder. All your data will be stored in the workspace local folder. You can accept the default or choose a new location in your system.

How to do Eclipse Configuration in Java

 

3. If you select  “Use this as the default and do not ask again”, this dialog box will not come up again.

4. After closing welcome tab will display.

5. The visible parts of an eclipse window are below.

Eclipse-Window


Create New Project in Eclipse:

  1. Click on file menu and choosing New > Java Project
  2. If java project option is not available then go to other > Java Project

Eclipse java project

 

3. Enter the Project Name

4. Select the Java Runtime Environment (JRE) or leave it at the default.

5. Select the Project layout which determines whether there would be a separate folder for the source code and class file

6. The recommended option is to create separate folders for sources and class file.

Create a java Project

7. You can click on the finish button to create the project

8. The package explorer shows the newly created Java project

java project created

 

9. By right click on the src folder in package explorer New > Package

create package in src folder

 

10. After that New Java package window open to create java package.

Java package creation window

 

  • Enter the package name.
  • Click on finish button.
  • The package explorer will show the newly created package under the source folder.

 

  • After creating package e.g. firstPackage
  • Right click on that package Select > New > Class

Create Java Class

 

Java Class

 

  • Click on finish to create the class.

 

Java Class Created

 

 

 


How To Run Java Program in Eclipse:

In left hand side package explorer view:

  • Right click on the class which you have created
  • Select Run As > Java Application

Run Java Program from Eclipse


Various Shortcut Keys in Eclipse:

1Any type of relevant suggestionCtrl + Space
2Main MethodType “Main” and Ctrl + Space. Select main from suggestion
3Printing StatementType “syso” and Ctrl + Space.
4Delete LineCtrl + D
5Duplicate LineCtrl + Alt + Down Arrow
6CommentCtrl + Shift + Forward Slash
7Save All FileCtrl + Shift + S
8Close FileCtrl + W

How to Add Extra Plugin in Eclipse:

Go to Help > Eclipse Market Place

Eclipse Marketplace

Below dialog box will be open. Type plugin name and hit enter.

Eclipse Market Place Window


How To Add External libraries in our project in eclipse:

If you are going to use API which is except Java and J2ee then we need to add external libraries in our project.

For Java and J2ee it automatically install by default when we install JDK (Java Development Kit).

E.g. If I want to use Selenium then we need to add external jar file of Selenium into eclipse.

Right click on project > Build path > Configure Build Path

How To Add External Libraries in Eclipse

 

Add External Jar in Eclipse

 

After Select jar files from your local PC, Click on Apply and Close button.


Eclipse Configuration Settings:

Editing the Launch Configuration Parameters-

In order to run an application, if we need to explicitly set the working directory, we need to edit the launch configuration parameters for the application.

Follow below steps to edit launch configuration parameters-

Right click on project > Click on Properties

 

 

Run Debug Setting in Eclipse

 

Click on Run/Debug Setting > Click on New button. After click on New button we can see below screen.

 

Select ‘Java Application’ and Click on OK. Then below screen will be open.

Edit launch Configuration Properties

 

You can edit here any section as per your choice.


Summary:

In this post, we have covered “Eclipse Configuration” For Java, how to write first Java program, how to run it and various shortcut Keys which use is useful while writing Java programming.

I am sure this content added some additional value in your skills and also helpful to configure eclipse.

Final word, Bookmark this post “Eclipse Configuration” for future reference.

If you have other questions or feedback, the comment section is yours. Don’t forget to leave a comment below!

 

Must Read:

How to Install Jenkins on Windows

Leave a Comment