13. Install Java JDK and Configure

Eclipse IDE is required to develop Selenium Automation Scripts in Java programming language. But we cant run Eclipse IDE without having Java Development kit (JDK) installed in our machines. So we have to install Java JDK first as explained in the below steps:

1. Open http://www.oracle.com/technetwork/java/javase/downloads/index.html in any browser
2. Select 'Java Platform (JDK) category' to download Java JDK as shown below -




3. Select the 'License Agreement' as shown below:




4. Download the 32 bit version of Java JDK (i.e. Windows x86 in the below screen) if you have 32 bit machine else if you have 64 bit machine install 64 bit version of Java JDK  (i.e. Windows x64 in the below screen) -




5. Install the downloaded JDK file and ensure that JDK and JRE folders got created at the C:\Program Files (x86)\Java folder path for 32 bit machine (But for 64 bit machine they will get created at the C:\Program Files\Java folder)




Configuring the Java JDK:

Follow the below steps to configure the Java JDK:

We have to configure the Java by configuring the build path.

If you want to save the created java files outside the bin folder then you have to set path of JDK. Path is required for using Javac and Java tools. Javac tool compiles the Java code and Java tool will run the code.

How to set path of JDK will be explained below:

1. Click on 'My Computer' icon on your desktop as shown below - 



2. When your drives are displayed in your My Computer window, right click any where inside the window and select 'Properties' option as shown below -



3. Click on 'Advanced System Settings' option as shown below:



4. Click on 'Environment Variables Button as shown below:



5. Click on 'New' button under the User variables as shown below:


6. Type 'path' into the 'Variable Name' as shown below:


7.  In 32 bit machines -> Go to C:\Program Files (x86)\Java\jdk[Version]\bin folder and copy the path of the bin folder as shown below (But in 64 bit machines -> You need to go to C:\Program Files\Java\jdk[Version]\bin folder )



8. Paste path of the bin folder in Variable Value field as shown below and click on 'OK' button



9. Ensure that the path is added under the User variables and Click on 'OK' button as shown below to finish the process



Check whether the Installed and configured Java works:

1. Open Windows Command line 
2. Type the command java -version in the Command line window  and press 'Enter' key on your keyboard 
3. Ensure that the Java version we've installed and configured is displayed on executing the command specified in step 2 
If you see the version of Java that is installed , it means that your Java is working.

Now you are ready to compile and run any java program.



Notes - 

1. You can also install JRE (Java Run Time Environment) instead of JDK (Java Development Kit). You can use Eclipse IDE and develop automation scripts when you install JRE instead of JDK prior to installing Eclipse IDE as Eclipse IDE contains its own features for developing and compiling Java.


2. If you want to Run Java Programs using any other editors instead of Eclipse IDE, then installation of Java JDK is must as the editors wont have  features to develop and compile Java programs. So installing JRE prior to running Java programs on any other editors instead of Eclipse IDE wont work. JDK is must in this case.


3. When you are running your automation scripts developed using Java programming language on Eclipse IDE, you can simply install JRE instead of JDK if you want to save your computers memory. JRE installation take less time and less memory to store.


No comments:

Post a Comment