Google+

7. 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 as shown below:



2. Type the command java -version in the Command line window as shown below and press 'Enter' key on your keyboard as shown below:


3. Ensure that the Java version we've installed and configured is displayed on executing the command specified in step 2 as shown below:




If you see the version of Java that is installed as shown in the above screenshot, 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.





Please comment below to feedback or ask questions.

How to install Eclipse IDE will be explained in the next post.



10 comments:

Unknown said...

Hi Arun,

Enjoying learning Selenium on your blog. Appreciate your efforts.

Thanks and regards,
Raghu

Arun Motoori said...

@ Raagu Thank You

Unknown said...

hi
can we use this Java Platform (JDK) 8u20 for ur tutorials. Mine is windows 7 ultimate 32 bit machine.

Arun Motoori said...

@Shika Reddy - Yes, you can use JDK 8.

Kirri's said...

you are simply amazing... loving it so far.. not to undermine the efforts you are putting, but it would be great if you can add these kind of instructions even for mac book... people like me who have zero knowledge on Java/JDK/JRE, it would be very helpful... I can able to compile java code in my system, now am not sure, if that would be enough, or do I need to install any of these... may be too much to ask.. :)

patel said...

thanks a lot

Unknown said...

Hi Arun,
Thanks for your efforts for explaining So well.

Thanks,
Kaleem

fathima lijiya said...

Hi Arun,

Thanks for your explanation from the basic and epalaining in detail.Am in tetsing field for php,i would like to know do i have to install this eclipse IDE for tetsing php programing also,i get confused when i reached this page so please suggesnt me.

anil kumar said...

Hi Arun, Happy learning for me through you blog ..great efforts

I need a small clarification in the above Notes 3 point :
If you are installing jre alone and running our scripts in Eclipse will be dependent / independent.. in a simple way will there be any differences in execution in 2 flow's like installing jdk and jre & with only JRE..
Please help me on this

Unknown said...

Hi Arun.. This is Lanna.. Im really enjoying this blog. Learning selenium from your blog is easy and helpful. Thanks for your effort