“Hello World!”- My First Java Program in Eclipse. – User friendly Tech help
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 🙂
n
nRequirement:- How to write a Java program in Eclipse?
n
nSolution:-
nStep1:-
nAfter downloading Eclipse, launch the IDE and select the WorkSpace.
n
Launching Eclipse |
n
n
nStep2:-
nFile ->New->JavaProject
nClick Finish
n
Creating Java Project |
n
Step3:-
nProgram will be created,under Package Explorer(On the Top Left Corner)
nNote:-Incase “Package Explorer” is not visible, follow the path, Window->ShowView->Package Explorer
n
Package Explorer |
n
Step4:-
nFile->New->Class
nor
nRight Click the “Java Project ” in Package Explorer ->New ->Class
n
n
nStep5:-
nGive the Name of “Class” and click Finish
nNote:- Select the option “public static void main(String[] args)” incase you want default method to be included in the code
n
Adding Class with default Method |
n
Step6:-
nType “sysout” -> Press “CTRL+SpaceBar” -> Select the sysout option.
n
nNote:- We can use -> “main” + CTRL+SpaceBar for creating “Public static void Main” method.
n
SYSOUT shortcut |
n
Step7:-
nWrite most awaited “HelloWorld!” inside the System.out.println(); and “File->Save”
n
Step8:-
nRightClick the ProgramName ->RunAs->JavaApplication
nor
nDirectly click the “Run” icon on the ToolBar(CTRL+F11)
n
Run Java Program |
n
Step9:-
nOn the bottom, check the results under “Console”
n
Console Result |
n
Congrats!!We are done with our First Program 🙂
n
Now let us learn how to write our first selenium test case..