Installing the Java Development Kit (JDK)
The JDK is the development environment for building applications, applets, and components using the Java programming language. This tutorial will teach you how to download and install the JDK. Once the JDK is installed, you will learn how to set your environment variables and ensure that java compiler and java runtime are working properly.
Oracle acquired Java with the purchase of Sun Microsystems back in 2010. Oracle provides the download and installation of the JDK free of charge. The download is located on their Java SE Downloads page, the link below will open to a page with several options for downloads. Be sure to select the Java Platform (JDK) followed by an 8u + the current build number.
Before you click the link below you are going to need to know whether your Windows OS is 64-bit or 32-bit(x86). Right-click on your My Computer icon and select Properties from the drop-down menu. A System form will appear with an entry for System Type. If you see the words 64-bit and/or x64 then you are running a 64-bit system. If not then you are running an x86. With that knowledge, go ahead and click the link below.
Once the download (~200MB) is complete, go ahead and run the installation program.
Click Next to begin the installation.
Click Next at this screen.
The installation is complete, but there is always one more issue to deal with. Go to Start, Search or Run (depending on which version of windows you are running), and type in CMD.exe then Enter.
From the command prompt, type in javac and then press Enter.
You should see an error 'javac' is not recognized as an internal or external command, operable program or batch file.
This is because the %PATH% system variable does not contain the directory for the javac.exe compiler.
We will need to locate the Java compiler executable(javac.exe).
Type in cd \ then press Enter.
Type in dir javac.exe /s the press Enter.
It may take a minute depending on the speed and size of your hard drive, but once it finds the file, you'll now know the directory that javac.exe is located in.
Right-click on your My Computer icon and select Properties from the drop-down menu. The System properties window will have an option on the left hand side for Advanced system settings, click it.
Click the Environment Variables button.
Highlight the Path variable and press Edit.
Scroll to end of the Variable value: and type in a semicolon ; plus the directory path that you obtained from the command prompt. Click OK. !Reboot your computer!
Open the command prompt back up by going to Start, Search or Run (depending on which version of windows you are running), and type in CMD.exe then Enter.
Type in cd \ then Enter.
Type in javac then Enter.
If you see a list of a whole bunch of javac options, then congratulations on successfully installing the JDK and setting the necessary file paths!