How to Download and Install Java

Submitted by MoumitaMalik on Sat, 05/12/2018 - 15:15

In this tutorial, we will learn "How to Download & Install Java in Windows". This Java Development Kit (JDK) allows you to code and run Java programs. It's possible that you install multiple JDK versions on the same PC. But Its recommended that you install only latest version.

Following are steps to install Java in Windows -

Step 1) Go to the following link- www.oracle.com/technetwork/java/javase/downloads/index.html. Click on Download JDK, for java latest version as depicted below -

 

Download installer_1st step

 

Step 2) Then it will ask for following 2 points -

      a) Accept License Agreement

      b) Download latest Java JDK for your version (32 or 64 bit) of java for Windows.

 

download installer


 

Step 3) Once the download is complete, run the exe for install JDK. Amd to procees next step, click on Next.

 

installation process_1st step

 

Step 4) Once installation is completed click Close

 

Installation Completeed

 

After the JDK installation, some folders will be created on your hard drive. These are mentioned below - 

  • bin - This folder contains a compiler and other development tools.
  • demo - An example demo program to understand different features of Java.
  • include - In this, files are integrated to integrate Java with other languages.
  • jre - This folder contains runtime environment files.
  • lib - This folder contains Java library files.
  • src - This folder contains source code for Java API classes.

Some essential tools exist in the bin folder:

  • javac - This is Java compiler.
  • java - This is an interpreter.
  • Appletviewer - This is used to view applet.
  • javap - It is used to convert bytecode into program description.
  • javah - This includes header files.
  • javadoc - It is used for the HTML document.

Before moving to next topic, we need to know the followins - 

What is Path ?

Once you installed Java on your machine, it is required to Set the PATH environment variable to conveniently run the executable (javac.exe, java.exe, javadoc.exe, and so on) from any directory without having to type the full path of the command. So, basically 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 A.java instead of simple javac A.java.

What is ClassPath ?

Classpath is system environment variable used by the Java compiler and JVM. Java compiler and JVM is used Classpath to determine the location of required class files. The CLASSPATH variable gives location of the Library Files.

Difference between Path & ClassPath ?

Path Classpath
Path variable is used to set the path for all Java software tools like javac.exe, java.exe, javadoc.exe, and so on. Classpath variable is used to set the path for java classes.

 

How to set Environment Variables in Java: Path and Classpath

Let's look into the steps to set the PATH and CLASSPATH

Step A) Right Click on the My Computer and Select the properties, as shown below - 

 

Environment veriables

 

Step B) Click on advanced system settings

 

Advance System settings

 

Step C) Click on Environment Variables

 

Environment veriables_next step

 

Step D) Click on new Button of User variables

 

Environment veriables_next step

 

Step E) Type PATH in the Variable name.

 

Environment veriables_next step

 

Step F) Copy the path of bin folder which is installed in JDK folder.

 

Environment veriables_next step

 

Step G) Paste Path of bin folder in Variable value and click on OK Button.

 

Environment veriables_next step

 

Note: In case you already have a PATH variable created in your PC, edit the PATH variable to

PATH = <JDK installation directory>\bin;%PATH%;

Here, %PATH% appends the existing path variable to our new value.

Step H) You can follow a similar process to set CLASSPATH.

 

Environment veriables_Classpath

 

Note: In case you java installation does not work after installation, change classpath to

CLASSPATH = <JDK installation directory>\lib\tools.jar;

Step I) Click on OK button

 

Environment veriables_next step

 

Step J) Go to command prompt and type javac commands.

If you see a screen like below, Java is installed.

 

Environment veriables_Final step

 

Comments

Related Items

Introduction to Java Platform

Java is a general-purpose, object-oriented programming language developed by Sun Microsystem in 1991. It is one of the most used programming languages....