To code in Java, you need Java Development Kit (JDK). JDK is also known as “Java Platform, Standard Edition” or simply Java SE. The JDK or Java Development Kit can be freely downloaded from official website of Sun Microsystems which is now very much the part of Oracle.

Official link: https://www.oracle.com/technetwork/java/javase/overview/index.html

IMPORTANT : This tutorial is just to help you learn how to install Java JDK/Java SE on your own. At the time of writing this article – it does talks about the latest version of Java JDK, which might not be same at the time you are reading this document and installing Java JDK. I will try my level best to update this document as and when required. Still – You should keep in mind that screenshots and versions might vary little bit, but most of the time process of installing remains same. 

What should I go for – “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 (developing) 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.

Follow the following steps to install the latest version of Java SE/JDK in windows:

Step 1: First of all it is recommended to keep the latest version of java JDK. For that you might need to uninstall any already installed previous version of Java JDK.

  • In case you want to remove any previous version of Java:
    • Just Goto “Control Panel” -> “Programs” -> “Programs and Features” -> Un-install ALL programs begin with “Java”.
      • For example “Java SE Development Kit…” or
      • “Java SE Runtime …” or
      • “Java X Update …”, and etc.

Step 2: Once ready – Navigate to this link that will take you to the official website : Download from here.

latest java jdk

latest java JDK

  • You can also choose from other versions available:
java download required version

java download required version

Step 3: You will be required to accept the Licence Agreement. Do that.

Step 4: Download latest Java JDK for your version(32 or 64 bit depending upon your processor) of java for Windows.

NOTE: IF YOU ARE HAVING 64 bit MACHINE, THEN ONLY YOU CAN GO FOR – Java SE Development Kit 11 

JDK 11 and above

Java JDK 11

NOTE: IF YOU ARE HAVING 32 bit MACHINE, THEN YOU CAN CHOOSE APPROPRIATE – Java SE Development Kit

java-for-32-bit-windows

java-for-32-bit-windows

Step 5: Once the download is complete, run the executable file to install JDK.

  • It opens up the wizard.
  • Accept the defaults and follow the screen instructions to install JDK and JRE.
  • Keep on pressing NEXT

Step 6: Once Installed , Press CLOSE 

  • JDK is installed in directory “C:\Program Files\Java\jdk-10.0.{x}”and
  • JRE is installed in “C:\Program Files\Java\jre-10.0.{x}”.

Notes:

  • Here {x} denotes the upgrade number or version number
  • In 64-bit Windows, “Program Files” is meant for 64-bit programs; while in case of 32-bit installation you will find  “Program Files (x86)” instead of “Program Files” in the path above.

Set Environment Variables in Java: Path and Classpath

Step 7: You will be required to set these paths so that java executable path is available, from where ever you run or compile your code.

  • The PATH variable gives the location of executable files (For compiler and interpreter, respectively) –  javac, java etc.
  • Though you can run a program without specifying the PATH,  but you will have to provide full path of executable compiler “Javac” and interpreter “Java” every time you compile or execute/run your code.

The CLASSPATH variable gives location of the Library Files.

Follow the steps to set the PATH and CLASSPATH for Java jdk:

  • Through Menu
    • Right Click on the My Computer and Select the properties
    • Select “Advanced System Settings
  • Or, simply Open “Run” prompt -> type “SystemPropertiesAdvanced”
  • It opens up a dialog box
environment-variables

environment-variables

  • Click the button labelledEnvironment Variables”, another dialog box appears:

setting-path-for-java

setting-path-for-java

  • You will find two sections: User Variables and System Variables:
    • Use User Variables to set User-Wide environment settings
    • Use System Variables to set System-Wide environment settings (For all the users)
  • In User-Variables
    • Search for “PATH” variable, if already exists, just modify to add the Java path
    • Create a new “PATH” variable in case one does not exists
Java User Path

Java User Path

  • In case of System Variables:
java-system-path

java-system-path

Step 8: Follow the same process to set a CLASSPATH

 


Difference between PATH and CLASSPATH

Path is an environment variable which is used by the operating system to find the executables.

Classpath is an environment variable which is used by the Java compiler to find the path of classes. 


Step 9: Verify Installation

To verify, you have successfully installed Java JDK or not, follow the steps:

  • Open “Run” prompt -> type “CMD” to open cammand prompt
  • Type “Javac”, it it was successfully installed, screen similar to the one below appears.
Verifying Java installation

Verifying Java installation

So now you are done. You can easily follow these instructions and install Java jdk on your own.

 

Pawan Arora AdministratorKeymaster
Founder , Edukers
Teaching, Coding and Sharing is his passion. A true mentor and motivator. C/C++, Python, Java, Web Technologies (html5 / CSS/ Javascript/ JQuery,Bootstrap, nodeJS ,PHP etc.) and a WordPress enthusiast with more than two decades of experience.
follow me