Only institute to provide recording daily after class to students. Only institute you can practice whole day under faculty guidance. Only institute where test and mockup tests are taken regularly. Only institute provides all mobile nos of old students on website.

Set Path In Java

When we compile or run java application using cmd prompt without setting path variable, It will not compile but gives error below shown in cmd screen.

Java By Kiran

This error is mainly due to cmd is not recognizing the javac command or java tool and other java librararies, hence to know these command to cmd we need to give the path of these tool (javac). So This path is nothing but the location of javac tool. And path is---C:\Program Files\Java\jdk1.7.0\bin
i.e we are giving path of jdk installed on our machine.(****You should have java install)
  • How to set setpath variable to run java application through cmd prompt?
There are two ways to set setpath variable ,as below
1. Temporarily setting path through cmd only
2. Permanently setting path through (system)environment variable

Firstly, let’s see first Approach
In this approach we set path variable using cmd like setpath=C:\Program Files\Java\jdk1.7.0\bin
and is valid to current open cmd instance only. If we exit cmd and open new cmd instance then again we need to set path variable hence we called it as temporary path variable..
let’s see screen of cmd to set path variable
Java By Kiran

Now we can compile and run java program
Java By Kiran

Main drawback of temporarily setting path is each time we open new instance of cmd we need to set path again and again.
To overcome this we have Second Approach.

Let’s see,
In this we set path variable using environmental variable like process given below.

1. Right click on computer------go to the properties and click on it
Java By Kiran

2. Go to the Advance System Setting and click on it
Java By Kiran

3.Now Click on Environmental Variables..
Java By Kiran

4.Click on New...in User Variables