Tutorial Install Java Development Kit 10 (JDK 10) on Windows 8

0. Un-Install Older Version(s) of JDK/JRE

Goto “Control Panel” ⇒ “Programs” ⇒ “Programs and Features” ⇒ Un-install ALL programs begin with “Java”, such as “Java SE Development Kit …”, “Java SE Runtime …”, “Java X Update …”, and etc.


1. Download JDK 10

  • Under “Java SE Development Kit 10.0.{x}” ⇒ Check “Accept License Agreement”.
  • Choose the JDK for your operating system, i.e., “Windows” (for 64-bit Windows OS), and download the installer (e.g., “jdk-10.0.{x}_windows-x64_bin.exe” – 390MB).3.JPG

2. Install JDK

Run the downloaded installer (e.g., “jdk-10.0.{x}_windows-x64_bin.exe”), which installs both the JDK and JRE.

By default:

  • JDK is installed in directory “C:\Program Files\Java\jdk-10.0.{x}”, where {x} denotes the upgrade number5.JPG
  • JRE is installed in “C:\Program Files\Java\jre-10.0.{x}”6.JPG

Notes: In 64-bit Windows, “Program Files” is meant for 64-bit programs; while “Program Files (x86)” for 32-bit programs.

Accept the defaults and follow the screen instructions to install JDK and JRE.

Use the “File Explorer”, goto “C:\Program Files\Java” to inspect these folders. Take note of your JDK installed directory, in particular, the varying upgrade number, which you will need in the next step.

In the following diagram, the JDK installed directory is “C:\Program Files\Java\jdk-10.0.2”, where {x}=2. I shall refer to the JDK installed directory as <JAVA_HOME>, hereafter, in this article.


3. Include JDK’s “bin” Directory in the PATH

Windows’ Shell searches the current directory and the directories listed in the PATH environment variable (system variable) for executable programs. JDK’s programs (such as Java compiler javac.exe and Java runtime java.exe) reside in the sub-directory “bin” of the JDK installed directory. You need to include “bin” in the PATH to run the JDK programs.

To edit the PATH environment variable in Windows 8 :

  • Launch “Control Panel” ⇒ (Optional) System and Security ⇒ System ⇒ Click “Advanced system settings” on the left pane.9.JPG
  • Switch to “Advanced” tab ⇒ Push “Environment Variables” button.8.JPG
  • Under “System Variables” (the bottom pane), scroll down to select “Path” ⇒ Click “Edit…”.                                                      10.JPG

(CAUTION: Read this paragraph 3 times before doing this step! Don’t push “Apply” or “OK” until you are 101% sure. There is no UNDO!!!)

(To be SAFE, copy the content of the “Variable value” to Notepad before changing it!!!)


In “Variable value” field, INSERT “c:\Program Files\Java\jdk-10.0.{x}\bin” (Replace {x} with your installation number!!!) IN FRONT of all the existing directories, followed by a semi-colon (;) which separates the JDK’s bin directory from the rest of the existing directories. DO NOT DELETE any existing entries; otherwise, some existing applications may not run.

Variable name : PATH

Variable value : c:\Program Files\Java\jdk-10.0.{x}\bin; [do not delete exiting entries…]


Notes : Starting from JDK 1.8, the installation created a directory “c:\ProgramData\Oracle\Java\javapath” and added to the PATH. It contains only JRE executables (java.exe, javaw.exe, and javaws.exe), but NOT the JDK executables (e.g., javac.exe).

4. Verify the JDK Installation

Launch a CMD shell via one of the following means:

  • Click “Search” button ⇒ Enter “cmd” ⇒ Choose “Command Prompt”, or
  • right-click “Start” button ⇒ run… ⇒ enter “cmd”, or
  • (Prior to Windows 10) click “Start” button ⇒ All Programs ⇒ Accessories (or Windows System) ⇒ Command Prompt, or
  • (Windows 10) click “Start” button ⇒ Windows System ⇒ Command Prompt.

Issue the following commands to verify your JDK installation:

  • Issue “path” command to list the contents of the PATH environment variable. Check to make sure that your <JAVA_HOME>\bin is listed in the PATH.
    Don’t type prompt>, which denotes the command prompt!!! Key in the command (highlighted) only.           13.JPG14.JPG
  • Issue the following commands to verify that JDK/JRE are properly installed and display their version:15.JPG16.JPG

5. Write a Hello-World Java Program

  • Create a directory to keep your works, e.g., “d:\myProject”, or “c:\myProject”, or any directory of your choice. Do NOT save your works in “Desktop” or “Documents” as they are hard to locate. The directory name shall not contain blank or special characters. Use meaningful but short name as it is easier to type.
  • Launch a programming text editor (such as TextPad, or NotePad++, or Sublime Text, or Atom). Begin with a new file and enter the following source code. Save the file as “Hello.java”, under your work directory (e.g., d:\myProject).17.JPG

6. Compile and Run the Hello-World Java Program

To compile the source code “Hello.java” :

  • Start a CMD Shell (Click the “Start” button ⇒ “run…” ⇒ Enter “cmd”).
  • Set the Current Drive to the drive where you saved your source file “Hello.java”. For example, suppose that your source file is saved in drive “d”, enter “d:” as follow:18.JPG                                Don’t enter prompt>, which denotes the command prompt.
  • Set the Current Working Directory to the directory that you saved your source file via the cd (Change Directory) command. For example, suppose that your source file is saved in directory “d:\myProject”.19.JPG
  • Issue a dir (List Directory) command to confirm that your source file is present in the current directory.20.JPG
  • Invoke the JDK compiler “javac” to compile the source code “Hello.java”. 21.JPGThe compilation is successful if the command prompt returns. Otherwise, error messages would be shown. Correct the errors in your source file and re-compile. Check “Common JDK Installation Errors”, if you encounter problem compiling your program.
  • The output of the compilation is a Java class called “Hello.class”. Issue a dir (List Directory) command again to check for the output.22.JPG

To run the program, invoke the Java Runtime “java”:23.JPG

Because I save Hello.java in “E:\Document” so this following display cmd on my pc :


Everything that can possibly go wrong will go wrong: Read “JDK Installation Common Errors”.

7. (Optional) Download JDK API Documentation, Demos and Samples

The JDK download does not include the documentation, which needs to be downloaded separately. In the past, I always insist that my students should have a local copy of JDK API Documentation. But, today, you can easily access the online copy by googling “JDK 10 Documentation”.

To install JDK API documentation:

  • From the Java SE download page (@ http://www.oracle.com/technetwork/java/javase/downloads/index.html), under “Additional Resources”, look for “Java SE 10 Documentation” ⇒ Download ⇒ Accept the license agreement ⇒ Download the zip-file (e.g., “jdk-10.0.{x}_doc-all.zip” – about 66MB).
  • Unzip into the JDK installed directory <JAVA_HOME>. The documentation will be unzipped into “<JAVA_HOME>\docs”. Browse the JDK documentation by opening “<JAVA_HOME>\docs\index.html”.

You should also download the “JDK x Samples and Demos” from the Java SE download site.

8. (For Advanced Users Only) JDK’s Source Code

Source code for JDK is provided and kept in “<JAVA_HOME>\lib\src.zip” (or “<JAVA_HOME>\src.zip” prior to JDK 9). I strongly recommend that you to go through some of the source files such as “String.java”, “Math.java”, and “Integer.java”, under “java\lang”.

Reference :


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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