How to install Java for Selenium Webdriver and set environment variable

Hello, Welcome to Selenium tutorial, in this post, we will see How to install Java for Selenium and how to set path variable.

For Selenium Webdriver We should have Eclipse, Java and TestNG.

 

How to install Java for Selenium

Install JAVA for Selenium

Step 1- Open any browser and search oracle official site and click on Download Section

How to install Java for Selenium

Oracle home page

Since Oracle has so many products, it will show all the product but we will Select JAVA which is required for us

 

How to install Java for Selenium

Click on Java

Java also comes with so many flavors but we will install only JAVA SE which means Java Standard Edition.

How to install Java for Selenium

Click on JAVA SE

In this section, you will get the entire JAVA version if you scroll down, you can download any version of JAVA 6 and here we will download

The latest version, which is Java8. Click on JDK

How to install Java for Selenium

Download JDK

Note- I will highly recommend please install only one Java version otherwise while running we might face some issues.

Just for more information, I added some screenshot for Java 7 as well for Java 7 you can scroll down then you can download Java7 as well.

How to install Java for Selenium

Step 2- Click on download link based on your requirement

Example- For Windows 32 please download Java 32 bit and for Windows 64 please download Java 64 bit.

 

Step 3- Please check your download folder or relative directory where Java has been downloaded and double-click on the .exe file.

Select the next and relative option and do the same until the installation finished.

 

How to install Java for Selenium and variable setup for JAVA

Step 4- Now last step we need to setup environment variable so that while running eclipse we should not face any issue.

To set environment variable simply right click on My computer and select the properties and click on Advanced system setting

How to install Java for Selenium

How to install Java for Selenium

Click on Environment variable and Set the user variable and click on new button

How to install Java for Selenium

 

Give variable name is JAVA_HOME and Give the path of java home directory.

Note- By default this will install in Program File

User Variable

How to install Java for Selenium

 

To set the system variable now edit existing path and give the path till bin

Note- Please do not make any other changes in System variable.

System Variable

How to install Java for Selenium

Now Click OK and Apply.

We are done with Java installation.

To verify that Java has been installed successfully or not we can check java version for this we will execute a small command and this will give version of Java

Open CMD and execute command java –version and press enter

This will give java version

How to install Java for Selenium

Finally, we have installed Java Now its time to write our first Selenium Script 🙂

 

 

 

Leave a Reply