Download and Install Java

  1. Click on this link: Download Java SDK
  2. The latest version of java/jdk is at top. other versions below it. You can download any version.
  3. Click on 'JDK Download' for any version of java. Here we are installing jdk 8 (i.e. Java SE 8u11 - this might be different when u do)
  4. You will see many downloads here. Go to section 'Java SE Development Kit 8u11'
  5. Here, you will have 2 downloadable files for windows. Windowsx86 and windows x64.
  6. Download the .exe file corresponding to Windows x86 (it you have 32 bit windows). If you have 64 bit windows, download .exe for Windows x64.
  7. After the download is completed, execute the .exe file to install java.
  8. Lets consider you have installed java at "D:\Java\jdk1.8.0_11" location. This location is called 'java home'
  9. After the installation is done, set path , the environment variable, to run javac from anywhere.

Setting path for Java

You need to set 'path' variable so that you can compile(javac) and run(java) java programs from anywhere. If you don't set path, you can use 'javac' and 'java' commands only from within java_home/bin folder.

For Windows 10 and Windows 8

  1. Open Control Panel : In Search, search for Control panel and open.
  2. In Control Panel select/open: System.
  3. Click the Advanced system settings link. New Pop-up Window will open.
  4. Click Environment Variables.
  5. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
  6. In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable.
  7. Give values as shown in below screenshot (Figure 1). Note: path points to bin folder of java installation directory(java_home).
  8. Click 'OK'. Agin 'OK'.

For Windows 7 and older

  1. Windows Start button > Computer > Properties > Advanced system settings
  2. This opens a pop up window - 'System properties'.
  3. Click 'Advanced' tab. Click 'Environment variables' button. This open another window.
  4. In the 'envorinment variables' windonw, click on 'New' button. This opens another window.
  5. Give values as shown in below screenshot (Figure 1). Note: path points to bin folder of java installation directory(java_home).
  6. Click 'OK'. Agin 'OK'.

Looking deeper into java installation

When you install java, below folders/files (as shown in Figure 2) gets created :
  1. bin : This contains executable file for developemnt tools like compiler (javac), java, javap etc. The 'PATH' environment variable should have an entry for this directory.
  2. lib : contains files used by development tools.
  3. jre : This is root directory for 'Java Runtime Environment'.
  4. src : This is a zip file, which is archieve of source code of java.