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 projects. So you can download jdk1.7 for learning purposes. After you download it, you can follow the below instructions to install it step by step.

1. How To Install JDK1.7 On Windows.

Click here to go to the jdk1.7.0_80 download page. There list the JDKs for all platforms on the download page. Click the download link at the end of one platform that feet your needs to download it. Note, do not download JRE, just download JDK. Before you can download, you must check the Accept License Agreement checkbox.

Before the JDK download process starts, if you are not login to Oracle, you need to log in first. If you do not have an Oracle account, you need to register one.

Double click the downloaded JDK installer file to install the JDK1.7.0_80. In the Open File – Security Warning popup dialog, click the Run button to start the installation process.

Please note the JDK installation path should not contain whitespace character, if not there may have errors when you run the java program. Keep default options unchanged and click the Next button until the installation complete.

2. How To Run Java And Set JAVA_HOME On Windows.

After you install JDK1.7.0_80, you can run java.exe in the terminal window with the command C:\Java\jdk1.7.0_25\bin\java.exe. But it is not convenient to run java in this method each time, so we need to add the java bin directory in the windows Path system environment variable value.

First, you need to add the JAVA_HOME system environment variable follow the below steps. Open the windows explorer, right-click This Computer and then click the Properties menu item in the popup menu list.

Click the Advanced system settings menu on the Properties window left side to open system properties dialog. Click the Advanced tab in the System Properties dialog, then click the Environment Variables button to open the Environment Variables dialog.

Click the New button in the Environment Variables dialog to add the JAVA_HOME system environment variable. Set variable name to JAVA_HOME, set the variable value to your JDK installed directory such as C:\Java\jdk1.7.0_80. Click the OK button to save the JAVA_HOME system environment variable.

Add java bin directory in Path system environment variable. Edit Path system environment variable in Environment variables list. Add  %JAVA_HOME%\bin; at the beginning of its value. Please note separate each bin path by a semicolon.

Now you can run the java command in a dos window directly as following.

C:\Users\zhaosong>java.exe -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

3. How To Install Eclipse On 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.

There have a few eclipse packages used for different coding languages. Select the one you preferred. Since we just want to develop a java project, so we can choose Eclipse IDE for Java EE Developers or Eclipse IDE for Java Developers. Choose the correct eclipse version, 32 or 64 bit which matches up to your operating system.

Save the download eclipse zip file into your local PC. Unzip the downloaded eclipse zip file into a folder you preferred. Wait until the unzip process finished. You do not need to install it, just double click the file eclipse.exe inside the extracted folder to start it. You can also create a shortcut for the eclipse.exe file on your desktop, then you can run it easily.

After the eclipse startup, you need to choose the workspace folder to save all your project files. I prefer to choose a custom folder as your workspace folder because it is easier to remember. Now you can see the eclipse welcome page after click OK on the above page.

4. How To Download JDK For Eclipse.

There is a default JDK installed with eclipse. You can follow the below instruction to find it. Open Eclipse, click Window —> Preferences menu item on the top eclipse menu bar to open the Eclipse Preferences window.

Click Java —> Installed JREs in the left panel of the popup dialog. You can see eclipse default installed JDK in the right panel. If you want to add download JDK for eclipse, just click Add button in the right panel.

Choose Standard VM  in the popup Installed JRE Types list, then click the Next button. It will popup the Add JRE / JRE Definition dialog window. Click the Directory… button after the JRE home: text box to choose your download JDK ( not JRE ) home directory( for example C:\Java\jdk1.7.0_80 ).

Click the Finish button then you can see the downloaded JDK for the eclipse has been added to the Installed JREs list. Check the checkbox before the JDK you just added. then click the OK button to save the changes.

Now you have added the downloaded JDK in eclipse, and you can read the reference article to learn how to create your first Java project and how to fix java Unsupported Exception.

5. References.

How to create a java project with myeclipse

How to fix java Unsupported major.minor version 51.0 Exception

Leave a Comment

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.