Beginner’s guide for install jdk(java delvelopment kit) and eclipse in windows

Before writing any java project, you need to install Java Development Kit(JDK) first. I use jdk1.7 in all my selenium webdriver example project.
So you can download jdk1.7 for learning purpose. After you download it, you can follow bellow instructions to install it step by step.

How to install JDK1.7 in windows

1. Click here to goto the download page.
jdk1.7 download page

2. Click link in above page to goto download area to download the latest jdk1.7 which version is jdk-7u80. Do not download jre, just download jdk. Before you can download, you must check “Accept License Agreement” radio box.
latest jdk1.7 download url

3. When you click the download link above, a dialog popup to let you save the java executable file to your local PC. If you are not login to oracle, you need login first. If you do not have an oracle account, you can also register one.
login to oracle before download

download jdk 7u80

4. Double click the downloaded install file to install.
jdk1.7U80 install file

5. Click Run to start the installation process.
click run to start install process
7. Keep default options unchanged and click Next button until the installation complete.

How to run java and set JAVA_HOME in windows

After you install JDK1.7, you can run java.exe by following command line.
C:\Java\jdk1.7.0_25\bin\java.exe
run java from jdk bin directory

But it is not convenient to run java in this method for each time, so we need to add java bin directory in windows Path system environment variable.

First you need to add  JAVA_HOME system environment variable.
1. Right click “My Computer” —> click “Properties” in popup menu then click “Advanced system settings” to open system properties dialog.

READ :   How To Use Java Code To Set File Permission

Click “Advanced” tab in “System Properties” dialog, then click “Environment Variables” button to open “Environment Variables” dialog.
set JAVA_HOME in windows system environment properties

2. Click “New” button in Environment Variables to add JAVA_HOME system environment variable. Set variable name to “JAVA_HOME”, set variable value to your jdk installed directory “C:\Java\jdk1.7.0_80”.
Click “OK” to save JAVA_HOME system environment variable.
add java_home environment variable

Add java bin directory in “Path” system environment variable.

Edit “Path” system environment variable in “Environment variables” list. Add  %JAVA_HOME% \bin to it. Seperate each bin path by semicolon.
add-java-bin-to-system-path

Now you can run java command directly as following.
run java with bin in system Path environment variable

How to install Eclipse in Windows

Eclipse is a free java development IDE( integrated development environment) tool. You can use it just after download and unzip the zip file into a local directory.

  1. There has a few of eclipse packages used for different coding languages. Select the one you prefered. Since we just want to develope java project, so we can choose “Eclipse IDE for Java EE Developers” or “Eclipse IDE for Java Developers“. Choose correct eclipse version, 32 or 64 bit which match up your operating system.Download Page: http://www.eclipse.org/downloads/eclipse-packages/
    eclipse installation package list page

2. Save the download eclipse zip file into your local PC.
eclipse download save to disk page

3. Unzip the downloaded eclipse zip file into a folder you prefered. Wait until the unzip process finished. You do not need to install it, just double click “eclipse.exe” inside the extracted folder to start it. You can also create a short-cut for eclipse.exe file in your desktop, then you can run it easily.
eclipse executable file

eclipse startup

4. After eclipse startup, you need to choose workspace folder to save all your project files. I prefer to choose a custom folder as my workspace folder because it is more easy to remember.
eclipse choose workspace folder

READ :   How To Integrate JUnit Framework Into Selenium Scripts

5. Now you can see following eclipse welcome page after click OK in above page.
eclipse welcome page after startup

How to configure custom JDK in eclipse

There is a default jdk installed with eclipse. You can follow below instruction to find it.
1.Open Eclipse. Click Window —> Preferences
change window preferences

2. Click Java —> Installed JREs in left panel of the popup dialog. You can see eclipse default installed jdk in right panel. If you want to add your custom installed jdk, just click Add button in right panel.
change java installed jre in eclipse window preferences

4. Choose “Standard VM” then click “Next” button.

5. Locate your custom jdk ( not jre ) home directory by click “Directory” button. (In my env, i use: C:\Java\jdk1.7.0_25)
select installed jdk home in eclipse window preferences installed JREs

6. Click “Finish” then you can see your custom jdk added in the list.
click finish button to add new installed jdk

7. Check the checkbox before the jdk you just added. then click “OK”.
check just installed jdk in eclipse window preferences

Now you has added your custom jdk in eclipse, and you can read following article to learn how to create your first java project and how to fix java Unsupported Exception.

How to create java project with myeclipse

How to fix java Unsupported major.minor version 51.0 Exception

(Visited 328 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.