How to Download & Install JDK on Windows :-
JDK(Java Development Kit) allows us to code and run Java programs.
Follow the below steps to download Java on windows :-
  • Go to link. Click on Download JDK. For java latest version.
JDK1
  • Accept License Agreement, Download the appropriate jdk depending on your windows(32 bit or 64 bit).
jdk2
  • Once the download is complete, run the exe for install JDK. Click Next.
jdk3
  • Once installation is complete click Close.
jdk4

How to set Environment Variables in Java: Path and Classpath :-

The path is required to be set for using tools such as javac, java, etc. If you are saving the Java source file inside the JDK/bin directory, the path is not required to be set because all the tools will be available in the current directory. However, if you have your Java file outside the JDK/bin folder, it is necessary to set the path of JDK.
The PATH variable gives the location of executables like javac, java etc. It is possible to run a program without specifying the PATH but you will need to give full path of executable like C:\Program Files\Java\jdk1.8.0_131\bin\javac allkonnected.java instead of simple javac allkonnected.java
The CLASSPATH variable gives location of the Library Files.
Steps to set Path :-
  • Open My Computer/This PC, Right Click and Select the properties.
  • Click on advanced system settings.
Path2
  • Click on Environment Variables.
Path3
  • Click on new Button of User variables. (Note: In case you already have a PATH variable created in your PC, edit the PATH variable)
Path4
  • Type PATH in the Variable name.
Path6
  • Copy the path of bin folder which is installed in JDK folder.
Path7
  • Paste Path of bin folder in Variable value and click on OK Button.
Path8
  • You can follow a similar process to set CLASSPATH.
  • Click on OK button.
Path5
  • Go to command prompt and type javac commands.
  • If you see a screen like below, Java is installed.
javac
You can check Java Version by running java –version command
javaversion
Why do we set PATH variable?
The path is most important environment variables of Java of java environment which is used to find the JDK binaries used to compile and run java in windows and Linux . The JVM contains JDK which has all the interpreter files and JRE which has all the library files.