Java Environment Setup
Java Environment Setup for Selenium
History of Java
Java was developed virtually twenty years back, launched inwards 1995 past times Lord's Day MicroSystems at i time acquired past times Oracle Corporation.
Features of Java
Java is a class-based object-oriented programming linguistic communication which is
Platform independent – that is it tin endure used on whatever Operating System similar Windows, Unix/Linux, in addition to Macintosh etc (intended to “write once, run anywhere” - important that compiled Java code(bytecode) tin endure run on whatever platform without recompilation)
Open origin (free software) – that is nether GNU General Public License
Java Environment Setup
Download Java from either java.com site or oracle.com site.
First nosotros conduct maintain to download Java-JDK (Java Development Kit) in addition to install it.
• In JDK nosotros Java compiler ascendency is available.
• From ascendency trace of piece of job prompt too nosotros tin execute coffee programs.
• If nosotros desire to write in addition to execute coffee programs, offset nosotros conduct maintain to gear upward coffee environment.
• We tin role whatever editor (note pad, etc.) for writing coffee programs exactly for executing nosotros require coffee environment.
Steps to download Java
• From oracle.com pick out ‘Downloads’ in addition to click on Java SE
• Now inwards the Java SE page click on the logo
• Select "Accept License Agreement"
• Next pick out operating surroundings or operating system
If you lot conduct maintain Windows 32-bit OS in addition to then pick out Windows x86 or if it is 64-bit OS in addition to then pick out Windows x64.
• Click on the download link in addition to download
• After installation, nosotros larn ‘Java’ folder inwards ‘C:\Program Files’ folder
Set Environment Variable Path (Path Variable)
• Environment variable path is laid inwards lodge to access Java software from whatever directory.
To laid surroundings variable path inwards MS Windows 7/10
• Select ‘My computer’ in addition to correct click
• Select ‘Properties’
• Select ‘Advanced organization settings’
• Select ‘Environment Variables’
• Select path variable
• Enter JDK Bin directory path.
• Paste it inwards the infinite given for variable value.
• Click Ok-ok-ok.
Note: How to larn JDK Bin directory path?
• After selecting organization variables,we conduct maintain to pick out path variables in addition to click on edit button.
• Then a window appears every bit edit organization variables.
• Here nosotros conduct maintain to conduct maintain JDKBin directory path
• Select My calculator >c drive>program files>java>jdk>bin
• Copy the path from address bar.
Verifying the Java Environment setup
• Launch ascendency prompt
• Type coffee (it provides details).
Steps to verify
• Select ‘run’, type ‘cmd’ to larn ascendency prompt.
• From whatever directory type coffee inwards ascendency prompt, it provides coffee details.
Or
• From whatever directory type javac (java compiler), it provides coffee compiler details.
Writing, Compiling & Executing Java Programs from Command line
• In calculator programming, nosotros conduct maintain three steps for writing in addition to execution of programs
• Writing, Compiling (compilation agency converting high score linguistic communication into machine score language) & Execution
Step:1 writing Java program
• Open ‘notepad’ in addition to write your offset Java Program every bit next
world shape Sample{
public static void principal (String [] args) {
System. out. println (“Hello Java”);
System. out. println (“Hello Selenium”);
}
}
-------------
Syntax 1.class Name (class Name should begin amongst uppercase letter)
2.main method (Java plan execution starts from principal method)
3.display controversy 1(every controversy should halt amongst semicolon)
4.display controversy 2(every controversy should halt amongst semicolon)
---------------
• Save the plan every bit Sample.java (save it on ‘desktop’ or whatever folder which is slow to access)
***Note: Java is illustration sensitive
Step:2 compiling coffee program
• First pick out ascendency prompt in addition to modify to plan file directory (‘desktop’ or whatever folder where you lot conduct maintain saved the Sample.java plan , type javac plan elevate in addition to run.
• Go to ascendency prompt . c:\......>
• Change plan file directory. c:\......>Cd Desktop
• Type c:\......\Desktop>javac Sample.java
• Click on Enter
Compilation is done in addition to nosotros larn the shape file on ‘desktop’ or whatever folder where you lot conduct maintain saved the Sample.java plan
Step:3 Execute or run the coffee program
Now execute the plan past times typing coffee in addition to plan elevate on ascendency prompt
• Type c:\......\desktop>java Sample.java
• Click on Enter
• Output is generated every bit below on console
Hello Java
Hello Selenium
Exit from ascendency prompt type c:\.....\desktop>exit.
Note:
• The plan file elevate in addition to shape elevate should endure the same every bit it is syntax rule.
• Whenever nosotros edit/modify the program, it is to endure compiled again
• Once the plan is compiled you lot tin run/execute multiple times
----------------------------------------------------
In Test Automation using selenium, nosotros role an Integrated Development Environment similar eclipse IDE, non notepad or command trace of piece of job for repose in addition to speed.
Eclipse IDE (Integrated evolution environment)
Eclipse IDE it is a platform to practise in addition to execute programs similar Java, Pearl, Python, Ruby, PHP etc
• Eclipse IDE is opened upward origin (Eclipse world license)
• It provides Editor, tending for syntax errors ,context help, car compilation, de-bugging facility etc
Downloading & Launching Eclipse IDE
• Go to google search page, type eclipse IDE download
• Click on eclipse downloads
• Download eclipse IDE for Java EE or eclipse IDE for Java developers
• Extract the zip file to a folder where nosotros uncovering eclipse.exe file, clicking the.exe file volition launch the eclipse IDE(No bespeak to install)
Sequence for creating Java plan inwards Eclipse IDE
> Create Java projection
>Create a package(under Java Project)
>Create Classes , Interfaces(under package)
Steps for creating Java plan inwards Eclipse IDE
• Navigation path for creating New Java Project:
Click on File->New->Java Project
Type Project elevate - eg ‘Sample’ in addition to click on Finish
• Navigation path for creating New Package nether created Java Project:
Right Click on created Java projection ‘Sample’, pick out New & click on Package
Type Package elevate – eg ‘selenium Testing’ in addition to click on Finish
• Navigation path for creating New Class nether created Java Package:
Right Click on created Java Package ‘selenium Testing’, pick out New & click on Class
Type Class elevate – eg ‘JavaProgram’ in addition to click on Finish
Writing & Executing the Java Program using Eclipse IDE
Click on the ‘JavaProgram’ & write the Java Program inwards the Editor( inwards the Right)
& Click on the Run to Execute the ‘JavaProgram’
Output is generated every bit below
Hello Java
Hello Selenium
Navigation for Editor Settings inwards Eclipse (Change Font size etc...)
Editor Text Fonts
Window(Menu)->Preferences->General->Appearance->Colors in addition to Fonts->Java->Java Editor Text Font->Edit
Output Console Fonts Window(Menu)->Preferences->General->Appearance->Colors in addition to Fonts->Debug->Console Fonts->Edit
Java Environment Setup for Selenium
History of Java
Java was developed virtually twenty years back, launched inwards 1995 past times Lord's Day MicroSystems at i time acquired past times Oracle Corporation.
Features of Java
Java is a class-based object-oriented programming linguistic communication which is
Platform independent – that is it tin endure used on whatever Operating System similar Windows, Unix/Linux, in addition to Macintosh etc (intended to “write once, run anywhere” - important that compiled Java code(bytecode) tin endure run on whatever platform without recompilation)
Open origin (free software) – that is nether GNU General Public License
Java Environment Setup
Download Java from either java.com site or oracle.com site.
First nosotros conduct maintain to download Java-JDK (Java Development Kit) in addition to install it.
• In JDK nosotros Java compiler ascendency is available.
• From ascendency trace of piece of job prompt too nosotros tin execute coffee programs.
• If nosotros desire to write in addition to execute coffee programs, offset nosotros conduct maintain to gear upward coffee environment.
• We tin role whatever editor (note pad, etc.) for writing coffee programs exactly for executing nosotros require coffee environment.
Steps to download Java
• From oracle.com pick out ‘Downloads’ in addition to click on Java SE
• Now inwards the Java SE page click on the logo
• Select "Accept License Agreement"
• Next pick out operating surroundings or operating system
If you lot conduct maintain Windows 32-bit OS in addition to then pick out Windows x86 or if it is 64-bit OS in addition to then pick out Windows x64.
• Click on the download link in addition to download
• After installation, nosotros larn ‘Java’ folder inwards ‘C:\Program Files’ folder
Set Environment Variable Path (Path Variable)
• Environment variable path is laid inwards lodge to access Java software from whatever directory.
To laid surroundings variable path inwards MS Windows 7/10
• Select ‘My computer’ in addition to correct click
• Select ‘Properties’
• Select ‘Advanced organization settings’
• Select ‘Environment Variables’
• Select path variable
• Enter JDK Bin directory path.
• Paste it inwards the infinite given for variable value.
• Click Ok-ok-ok.
Note: How to larn JDK Bin directory path?
• After selecting organization variables,we conduct maintain to pick out path variables in addition to click on edit button.
• Then a window appears every bit edit organization variables.
• Here nosotros conduct maintain to conduct maintain JDKBin directory path
• Select My calculator >c drive>program files>java>jdk>bin
• Copy the path from address bar.
Verifying the Java Environment setup
• Launch ascendency prompt
• Type coffee (it provides details).
Steps to verify
• Select ‘run’, type ‘cmd’ to larn ascendency prompt.
• From whatever directory type coffee inwards ascendency prompt, it provides coffee details.
Or
• From whatever directory type javac (java compiler), it provides coffee compiler details.
Writing, Compiling & Executing Java Programs from Command line
• In calculator programming, nosotros conduct maintain three steps for writing in addition to execution of programs
• Writing, Compiling (compilation agency converting high score linguistic communication into machine score language) & Execution
Step:1 writing Java program
• Open ‘notepad’ in addition to write your offset Java Program every bit next
world shape Sample{
public static void principal (String [] args) {
System. out. println (“Hello Java”);
System. out. println (“Hello Selenium”);
}
}
-------------
Syntax 1.class Name (class Name should begin amongst uppercase letter)
2.main method (Java plan execution starts from principal method)
3.display controversy 1(every controversy should halt amongst semicolon)
4.display controversy 2(every controversy should halt amongst semicolon)
---------------
• Save the plan every bit Sample.java (save it on ‘desktop’ or whatever folder which is slow to access)
***Note: Java is illustration sensitive
Step:2 compiling coffee program
• First pick out ascendency prompt in addition to modify to plan file directory (‘desktop’ or whatever folder where you lot conduct maintain saved the Sample.java plan , type javac plan elevate in addition to run.
• Go to ascendency prompt . c:\......>
• Change plan file directory. c:\......>Cd Desktop
• Type c:\......\Desktop>javac Sample.java
• Click on Enter
Compilation is done in addition to nosotros larn the shape file on ‘desktop’ or whatever folder where you lot conduct maintain saved the Sample.java plan
Step:3 Execute or run the coffee program
Now execute the plan past times typing coffee in addition to plan elevate on ascendency prompt
• Type c:\......\desktop>java Sample.java
• Click on Enter
• Output is generated every bit below on console
Hello Java
Hello Selenium
Exit from ascendency prompt type c:\.....\desktop>exit.
Note:
• The plan file elevate in addition to shape elevate should endure the same every bit it is syntax rule.
• Whenever nosotros edit/modify the program, it is to endure compiled again
• Once the plan is compiled you lot tin run/execute multiple times
----------------------------------------------------
In Test Automation using selenium, nosotros role an Integrated Development Environment similar eclipse IDE, non notepad or command trace of piece of job for repose in addition to speed.
Eclipse IDE (Integrated evolution environment)
Eclipse IDE it is a platform to practise in addition to execute programs similar Java, Pearl, Python, Ruby, PHP etc
• Eclipse IDE is opened upward origin (Eclipse world license)
• It provides Editor, tending for syntax errors ,context help, car compilation, de-bugging facility etc
Downloading & Launching Eclipse IDE
• Go to google search page, type eclipse IDE download
• Click on eclipse downloads
• Download eclipse IDE for Java EE or eclipse IDE for Java developers
• Extract the zip file to a folder where nosotros uncovering eclipse.exe file, clicking the.exe file volition launch the eclipse IDE(No bespeak to install)
Sequence for creating Java plan inwards Eclipse IDE
> Create Java projection
>Create a package(under Java Project)
>Create Classes , Interfaces(under package)
Steps for creating Java plan inwards Eclipse IDE
• Navigation path for creating New Java Project:
Click on File->New->Java Project
Type Project elevate - eg ‘Sample’ in addition to click on Finish
• Navigation path for creating New Package nether created Java Project:
Right Click on created Java projection ‘Sample’, pick out New & click on Package
Type Package elevate – eg ‘selenium Testing’ in addition to click on Finish
• Navigation path for creating New Class nether created Java Package:
Right Click on created Java Package ‘selenium Testing’, pick out New & click on Class
Type Class elevate – eg ‘JavaProgram’ in addition to click on Finish
Writing & Executing the Java Program using Eclipse IDE
Click on the ‘JavaProgram’ & write the Java Program inwards the Editor( inwards the Right)
& Click on the Run to Execute the ‘JavaProgram’
Output is generated every bit below
Hello Java
Hello Selenium
Navigation for Editor Settings inwards Eclipse (Change Font size etc...)
Editor Text Fonts
Window(Menu)->Preferences->General->Appearance->Colors in addition to Fonts->Java->Java Editor Text Font->Edit
Output Console Fonts Window(Menu)->Preferences->General->Appearance->Colors in addition to Fonts->Debug->Console Fonts->Edit