Download and install JDK, Setting environment variables JAVA_HOME & JDK PATH temporarily and permanently in windows, What is a path? need to set PATH variable?


Contents of page :
  • Download and install JDK>
  • Setting the JDK path in windows >
  • Then we will set environment variables
  1. JAVA_HOME &
  2. PATH  >
  • Understanding What is a path? Why we need set PATH variable?



Before executing your first program download JDK and setup environment variable.

Download and install JDK>
Download JDK(6 or 7 or 8) /  Java 7 / Java 8 (I’ll recommend Java7 for freshers)


Setting the JDK path in windows >
  • Go to My Computer, right click on properties
Click Advanced System setting, Environment Variable, New..



Then we will set environment variables
  1. JAVA_HOME &
  2. PATH  >


1. set JAVA_HOME >
Variable name : JAVA_HOME
variable value: C:\Program Files\Java\jdk1.7.0_51 (Directory in which java has been installed)

Click OK.


2. set PATH  >
Again click on New..
Then enter -
Variable name : PATH
variable value: C:\Program Files\Java\jdk1.7.0_51\bin
Click OK.





Setting temporary JAVA_HOME & PATH  >
open cmd
type
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_51
set PATH=C:\Program Files\Java\jdk1.7.0_51\bin

Once you will exit cmd JAVA_HOME and PATH will be lost.







Understanding What is a path? Why we need set PATH variable?

What is a path?
A path is a unique location of a file/ folder in a OS.
PATH variable is also called system variable or environment variable.

Why we need to set PATH variable?
PATH is used to store commands location so that we no need to type complete path in CMD to execute the commands.

Example >
If Java PATH variable is not set and we type java in cmd>
and press enter,
Error > (java is not recognized as an internal or external command)

If Java PATH variable is set and we type java in cmd>
and press enter,
Success > (java is recognized as command)


/** Copyright (c), AnkitMittal JavaMadeSoEasy.com */


RELATED LINKS>

Java tutorial - Advantage, Where is java used in real world, platform independent language


JDK path in Linux and Unix temporarily and permanently, What is a path?Why we need to set PATH variable? setting environment variable

No comments:

Post a Comment