Java Development Kit (JDK), officially named "Java Platform Standard Edition (Java SE)", which is freely available from Sun Microsystems (now part of Oracle), is needed for writing Java programs. The mother site for JDK (Java SE) is http://www.oracle.com/technetwork/java/index.html.
(To be SAFE, copy the content of the "Variable value" to Notepad before changing it!!!)
In "Variable value" field, INSERT "C:\Program Files\Java\jdk1.8.0_xx\bin" (Replace xx with your installation number!!!) IN FRONT of all the existing directories, followed by a semi-colon (;) which separates the JDK's binary directory from the rest of the existing directories. DO NOT DELETE any existing entries; otherwise, some existing applications may not run.
"JDK" or "JRE" ?
JRE (Java Runtime) is needed for running Java programs. JDK (Java Development Kit), which includes JRE plus the development tools (such as compiler and debugger), is need for writing as well as running Java programs. In other words, JRE is a subset of JDK. Since you are supposed to write Java Programs, you should install JDK, which includes JRE.How To Install JDK on Windows
Step 1: Download JDK
- Goto Java SE download site @ http://www.oracle.com/technetwork/java/javase/downloads/index.html.
- Under "Java Platform, Standard Edition" ⇒ "Java SE 8u{xx}", where {xx} is the latest update number ⇒ Click the "JDK Download" button.
- Look for the latest "Java SE Development Kit 8u{xx}" ⇒ Check "Accept License Agreement".
- Choose the JDK for your operating system, e.g., "Windows x64" (for 64-bit Windows OS) or "Windows x86" (for 32-bit Windows OS). You can check whether your Windows OS is 32-bit or 64-bit via "Control Panel" ⇒ (Optional) System and Security ⇒ System ⇒ Under "System Type".
Step 2: Install JDK and JRE
- Run the downloaded installer (e.g., "jdk-8u{xx}-windows-x64.exe"), which installs both the JDK and JRE. By default, the JDK will be installed in directory "C:\Program Files\Java\jdk1.8.0_xx", where xx denotes the upgrade number; and JRE in "C:\Program Files\Java\jre1.8.0_xx".
- Accept the defaults and follow the screen instructions to install JDK and JRE.
- Check the JDK installed directory by inspecting these folders using File Explorer. Take note of your JDK installed directory, in particular, the upgrade number, which you will need in the next step.
- I shall refer to the JDK installed directory as <JAVA_HOME>, hereafter, in this article.
Step 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 directory "<JAVA_HOME>\bin" (where <JAVA_HOME> denotes the JDK installed directory). You need to include "<JAVA_HOME>\bin" in the PATH to run the JDK programs.To edit the PATH environment variable in Windows 7/8/10:
- Launch "Control Panel" ⇒ (Optional) System and Security ⇒ System ⇒ Click "Advanced system settings" on the left pane.
- Switch to "Advanced" tab ⇒ Push "Environment Variables" button.
- Under "System Variables" (the bottom pane), scroll down to select "Path" ⇒ Click "Edit...".
- For Windows 10 (newer releases):
- You shall see a TABLE listing all the existing PATH entries (if not, goto next step). Click "New" ⇒ Enter the JDK's binary directory "c:\Program Files\Java\jdk1.8.0_xx\bin" (Replace xx with your installation number!!!) ⇒ Select "Move Up" to move this entry all the way to the TOP.
Prior to Windows 10:
(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\jdk1.8.0_xx\bin" (Replace xx with your installation number!!!) IN FRONT of all the existing directories, followed by a semi-colon (;) which separates the JDK's binary 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\jdk1.8.0_xx\bin;[exiting entries...]My 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, javaws.exe) but NOT the JDK executables (e.g., javac.exe).
Step 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.
// Display the PATH entries prompt> path PATH=c:\Program Files\Java\jdk1.8.0_xx\bin;[other entries...]
- Issue the following commands to verify that JDK/JRE are properly installed and display their version:
// Display the JRE version prompt> java -version java version "1.8.0_xx" Java(TM) SE Runtime Environment (build 1.8.0_xx-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode) // Display the JDK version prompt> javac -version javac 1.8.0_xx
0 comments:
Post a Comment