How to Install JDK 8
Step 0: Un-Install Older Version(s) of JDK/JRE :
If you have previously installed older version(s) of JDK/JRE, un-install ALL of them. Goto "Control Panel" ⇒ "Program and Features" ⇒ Un-install ALL programs begin with "Java", such as "Java SE Development Kit ...", "Java SE Runtime ...", and etc.
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.
- Check "Accept License Agreement".
- Choose your operating platform, e.g., "Windows x64" (for 64-bit Windows OS) or "Windows x86" (for 32-bit Windows OS).
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 latest upgrade number; and JRE in "C:\Program Files\Java\jre1.8.0_xx
".Step 3: Include JDK's "bin" Directory in the PATH
Windows OS searches the current directory and the directories listed in thePATH
environment 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 XP/Vista/7/8/10:- Launch "Control Panel" ⇒ "System" ⇒ Click "Advanced system settings".
- Switch to "Advanced" tab ⇒ "Environment Variables".
- Under "System Variables", scroll down to select "Path" ⇒ "Edit...".
- (CAUTION: Read this paragraph 3 times before doing this step! There is no UNDO)
For Windows 10: You see a table listing the existing PATH entries. Click "New" ⇒ Enter the JDK's binary directory "c:\Program Files\Java\jdk1.8.0_xx\bin
" (Replacexx
with your installation's upgrade number!!!) ⇒ Select "Move Up" to move it all the way to the top.
Prior to Windows 10: In "Variable value" field, INSERT "c:\Program Files\Java\jdk1.8.0_xx\bin
" (Replacexx
with your installation upgrade 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...]
Step 4: Verify the JDK Installation
prompt> path PATH=c:\Program Files\Java\jdk1.8.0_xx\bin ;[other entries...]
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
prompt> javac -version javac 1.8.0_xx
---------------------------------------------------------------------
Add/Update system environment variables using CMD:
To add/update system environment variables, you must use
the -m switch and open the command prompt using
Administrator privilege:
Click Start, type cmd. When the cmd.exe icon appears,
right click and select Run as administrator.
setx -m JAVA_HOME "C:\Program Files\Java\jdk1.8.0"
setx -m PATH "%PATH%;%JAVA_HOME%\bin";
Here are some important points:
- Always set JAVA_HOME when preparing development environment for Java.
- JAVA_HOME points to the installation directory of JDK.
- The PATH variable should contain an entry pointing to JAVA_HOME\bin.
- Environment can be set either via the GUI or command line prompt.
No comments:
Post a Comment