Download & Install the JDK
(Free Web Tutorials & Resources)
by Michael Thomas
(updated 10/18/2016)
Java First Steps Home Page
To begin to play with Java, you need to download the
following files: Java JDK (Java Development Kit)
aka SDK (Software Development Kit), JRE (Java Runtime
Environment) and the Java API Doc's.
Prerequisites
Summary of steps
Terms
Download the Java Products
You will be downloading the JDK (Java Development Kit), JRE (Java
Runtime Environment), Java Docs and optional sample/demos.
Install the JDK
Install Notes for: Java
SE 8U111
- WARNING NOTE: Here is information
in case the install fails and "bin\javac.exe"
get installed but is 0 bytes.
- The fix:
- The solution is to make sure the User's
"Environment Variables" for both TEMP & TMP are
set to "c:\temp" before starting the install.
(WARNING: First, make sure
that the directory exists: c:\temp)
I've seen the "bin\javac.exe" get installed with 0
bytes.
I've seen other software installs have similar issues so I
would leave it set to c:\temp unless multiple users use
the computer.
Maybe making sure the directory that the two variables
point to exists will fix the issue but I'm not sure.
- See the section below "Windows Environment Variables" to
see how to change the values.
- For reference, here is the default values for TEMP &
TMP:
TEMP: %USERPROFILE%\AppData\Local\Temp (Win 7, 8, 10)
- Reference Note: The "System Variables" TEMP & TMP
defaults to: %SystemRoot%\TEMP which is C:\Windows\TEMP
- Reference: Windows Environment Variables - how to
set/change
(NOTE: This section is for reference as needed during the
install)
- Win 10:
- Launch Control Panel, click "System & Security",
"System", "Advanced System Settings", click "Environment
Variables" (bottom right) then look in the top section
called "User variables for ...."
- Win 8
- I believe is the same as Win 10
- Win 7:
- Win XP Pro:
- Settings, Control Panel, System, Advanced tab, click on
"Environment Variable" button
- Version Java SE 8u111
- Install the Java SE JDK (Example of Windows 64
bit install)
File: jdk-8u111-windows-x64.exe
- Double click on the install file.
- Welcome Screen - click "Next"
- Screen: Custom Setup
- WARNING: Click "Change"
I suggest you use the following directory structure:
c:\_data\java\jdk1.8.0_111
Note: The default is:
C:\Program Files\Java\jdk1.8.0_111
Reasons why:
- The spaces in "Program Files" will give you
headaches down the road and may be difficult to
get certain applications working!
- I personally like having all my Java JDK
versions in a directory of my choice.
If possible, it is my preference to have
all my development tools and data I create under
the directory "_data".
- Optional notes for reference:
- Development Tools- JDK, JavaFX SDK, private
JRE, Java Mission Controls tools suite.
- Source Code - source for public API of Java
- Public JRE - standalone JRE (for browsers
& java runtime).
- Click "Next"
-
Screen: Destination Folder
- Check that you are installing to: c:\_data\java\jdk1.8.0_111
- Click "Next"
-
Screen: Complete
- Note: At the "Complete" if you click "Next
Steps" you will be taken to the online docs.
Online docs: http://docs.oracle.com/javase/8/docs
- Click "Close"
- Note: No reboot is required.
- Environment Variables: JAVA_HOME
- Add/Verify Environment Variables so other Java
tools/apps can use the value.
- Go to the "Windows Environment Variable"
add/edit screen. (See section above)
- Set the JAVA_HOME environment variable
In the "System Variables"
section: (not User variables)
Verify/Add the JAVA_HOME environment
variable:
Click "New"
Variable Name: JAVA_HOME
Variable Value: <Full path to the home
directory of your JDK install>
Ex: c:\_data\java\jdk1.8.0_111
Note: Other Java tools may use this
environment system variable like: Ant
(WARNING: Exit completely for setting to take
place. Close all DOS screens too!)
- Next, test the
JAVA_HOME setting.
Go to DOS and run the following:
DOS: set JAVA_HOME
Result should be: JAVA_HOME=c:\_data\java\jdk1.8.0_111
- From DOS run the following:
DOS: %JAVA_HOME%\bin\java.exe -fullversion
Results should be: java full version
"1.8.0_111-b14"
- Set the PATH System Environment Variable:Note:
This is only needed if you want to easily
compile from the DOS prompt. This is usually not
needed for IDE's Eclipse.
In the "System Variables" section: (not User
variables)
Edit the variable: Path
Add %JAVA_HOME%\bin
(For Windows versions prior to Win 10,
add the following to the end
of the PATH variable: ;%JAVA_HOME%\bin;)
(WARNING: Exit completely for setting to
take place. Close all DOS screens too!)
- Next, test the
path.
Go to DOS and run the following:
DOS: javac -help
Results: Should see info
- DOS: path
Results: Somewhere in the info towards the end
you should see "c:\_data\java\jdk1.8.0_111\bin;"
(NOTE: it converts to the value of JAVA_HOME.)
The System Variables are shown first and then
the "User Variables".
- Install the Java Docs
- NOTE: I suggest creating a separate directory for
the Java docs.
Create the directory: c:\_data\java\jdk1.8.0_111_docs
- Extract "jdk-8u111-docs-all.zip" to the
new directory.
You may need to move files around after extracting so they
are directly in the directory. Later you will test this
install.
-
Install the Java Demos & Samples
- NOTE: I suggest creating a separate directory for
the Java docs.
Create the directory: C:\_data\java\jdk1.8.0_111_demos
- Extract "jdk-8u111-windows-x64-demos.zip" to the
new directory.
You may need to move files around after extracting so they
are directly in the directory. Later you will test
this install.
Test the Installs of JDK, Java
Docs & Java Demos/Samples
- Reboot your PC - To be on the safe side, let's reboot.
Not normally necessary.
- Test Java Docs - Using a browser launch the following
files: (You may want to bookmark these.)
Offline (local) docs you installed:
file:///C:/_data/java/jdk1.8.0_111_docs/docs/index.html
- links to all offline docs.
file:///C:/_data/java/jdk1.8.0_111_docs/docs/api/index.html
- Java SE API offline doc.
Online docs:
http://docs.oracle.com/javase/8/docs
- links to all online docs.
http://docs.oracle.com/javase/8/docs/api/index.html
- online Java SE 8 API docs.
- Test the Java Demos
- From a browser (put in URL window)
- Applet Demos
file:///C:/_data/java/jdk1.8.0_111_demos/demo/applets.html
- Double click from Windows explorer or run from DOS prompt:
- Ensemble8 Demo
C:\_data\java\jdk1.8.0_111_demos\demo\javafx_samples\Ensemble8.jar
- MandelbrotSet Demo
C:\_data\java\jdk1.8.0_111_demos\demo\javafx_samples\MandelbrotSet.jar
- Modena Demo
C:\_data\java\jdk1.8.0_111_demos\demo\javafx_samples\Modena.jar
- Reference: Learn how to go to a DOS prompt. ( ie:
C:\> )
Windows: Click the start button, then in the run box type:
cmd.exe
Other Options:
* For Win 10: In the "Ask me Anything" put: cmd.exe (should show
Command Prompt)
* For Win 8: Start icon, Search icon, cmd.exe (click cmd.exe)
* For Win 7: Start, Programs, Command Prompt.
* For XP, Win200, NT: Click the start button, then in the run
box type: cmd.exe
* For Win 95/98: Click the start button, then in the run box
type: command.com
- Test the public JRE:
- At a DOS Prompt (ie C:\>) type: "C:\Program
Files\Java\jre1.8.0_111\bin\java.exe" -fullversion
(Warning: need the quotes ("...") because of the space in
"Program Files".)
Ex return: java full version "1.8.0_111-b14"
- At a DOS Prompt (ie C:\>) type: java -fullversion
Ex return: java full version "1.8.0_111-b14"
- At a DOS Prompt (ie C:\>) type: java -version
Ex return:
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed
mode)
- Test the private JDK's JRE:
- At a DOS Prompt (ie C:\>) type: c:\_data\java\jdk1.8.0_111\bin\java.exe
-fullversion
Ex return: java full version "1.8.0_111-b14"
- Test private JDK's javac.exe (compile Java source) command:
- At a DOS Prompt (ie C:\>) type: c:\_data\java\jdk1.8.0_111\bin\javac.exe
-help
Returns help for the command.
- (Note: If DOS gives the error: ... javac.exe is not
a valid Win32 application, the file exists but the byte size
= 0 then reinstall the JDK. I would change the Users
"Environment Variables" temp & tmp to "c:\temp". Then
click on the EXE again and choose the option to
"Reinstall". (voice of experience!).)
- Test your Environment Variable: Path
- If you will be compiling Java source code from the DOS
prompt then do this test. Some will only be compiling
with an IDE like Eclipse.
- At a DOS Prompt (ie C:\>) type: javac.exe -help
(Note: javac.exe and not java.exe!)
Ex return: Help info for javac.exe (Java compile)
command.
(Note: If you get a error, go back up to the section where
the PATH variable is set and follow those steps.)
- Test your Environment Variable: JAVA_HOME
- At a DOS Prompt (ie C:\>) type: %JAVA_HOME%\bin\javac.exe
-help
Returns help for the command.
(Note: If you get a error, go back up to the section where
the JAVA_HOME variable is set and follow those steps.)
- Optional Notes:
- java.exe - java.exe may come from several
locations!
- Warning: Every time you install a JDK or
JRE, the file "java.exe" is over written (see notes
below for the directory location). Remember this when
you are testing different JRE versions.
(Ex files: java.exe, javaw.exe, javaws.exe)
At a DOS Prompt (ie C:\>) type:
- Win 10:
C:\ProgramData\Oracle\Java\javapath\java.exe
-fullversion
- Win 8:
same as Win 7
- Win 7:
C:\Windows\System32\java.exe -fullversion
c:\Windows\SysWOW64\java.exe -fullversion
- Legacy Windows OSs:
c:\winnt\java.exe -fullversion
c:\windows\java.exe -fullversion
- Registry key 'Software\JavaSoft\Java Runtime
Environment\CurrentVersion'
Congratulations,
you have installed the JDK/SDK, JRE, and Java Docs!
Uninstall Notes