“Hello World!”- My First Java Program in Eclipse.

Understanding IDE of Eclipse is the core for starting with Selenium. Today we are trying our age long program “Hello World!” in Eclipse using Java.Hope it would motivate our automation lovers in the journey towards Java and Selenium using Eclipse 🙂

Requirement:- How to write a Java program in Eclipse?

Solution:-
Step1:-
After downloading Eclipse, launch the IDE and select the WorkSpace.

Eclipse
Launching Eclipse



Step2:-
File ->New->JavaProject
Click Finish

JavaProject Dialog
Creating Java Project

Step3:-
Program will be created,under Package Explorer(On the Top Left Corner)
Note:-Incase “Package Explorer” is not visible, follow the path, Window->ShowView->Package Explorer

Launch Package Explorer
Package Explorer 

Step4:-
File->New->Class
or 
Right Click the “Java Project ” in Package Explorer ->New ->Class


Step5:-
Give the Name of “Class” and click Finish
Note:- Select the option “public static void main(String[] args)” incase you want default method to be included in the code

Adding Class in Eclipse
Adding Class with default Method

Step6:-
Type “sysout” -> Press “CTRL+SpaceBar” -> Select the sysout option.

Note:- We can use -> “main” + CTRL+SpaceBar for creating “Public static void Main” method. 

SysOut in Eclipse
SYSOUT shortcut

Step7:-
Write most awaited “HelloWorld!” inside the System.out.println(); and “File->Save”

Step8:-
RightClick the ProgramName ->RunAs->JavaApplication
or 
Directly click the “Run” icon on the ToolBar(CTRL+F11)

Run Java Project in Eclipse
Run Java Program 

 Step9:-
On the bottom, check the results under “Console”

Result in Eclipse
Console Result

Congrats!!We are done with our First Program 🙂

Now let us learn how to write our first selenium test case..

ufthelp

Leave a Reply

Your email address will not be published. Required fields are marked *