How to handle the path problems windows | Techbirds

Hi all,

I recently found some of my colleagues getting stuck in “Path” problems in Windows OS. So, This is a very quick post on how to handle the path problems and what all these means.

1. How to do this

a. From your desktop right click on MyComputer(This PC in windows 8) or press WindowsKEY+E and right click and go to system properties by selecting Properties option.

b. This takes you to System properties window

    • open Advance system settings
    • on opened System Properties window in Advanced tab click Environment Variables 
    • This opens Environment Variables window which has two text areas.
      • user variables
      • system variables

c. Click the below New button in name field enter name of your environment variable. in value field enter the path for your variable.

Note:- Remember Not to put semicolon here (in value area)

d. Now in system variables Window you will find a variable named Path select it and click Edit (or simply double click on the row)..

e. Mention your variable here using %YOUR_VARIABLE_NAME%;

Note:- Here to separate each variable or paths DO PUT semicolon.

You are done, now you can access it from your dos prompt (remember to start a new instance every time you edit Environment Variables).

2. Why to do This.

This will put your SDK (commonly) commands to run from any directly you are working on in dos prompt.

3. What all This means.

1.Path variable: whenever we want to execute any command through DOS prompt we generally need this variable to contain the location of command. Since every time you try to execute anything from DOS prompt on your enter hit event DOS searches all your locations provided in Path variable and nowhere else. So to make your command available to DOS you need this variable.

2. User variable window: This window will contain all the Environment variables for current logged in user. These variables will not be available for other users on the system. The scope of this area is totally different from System variables i.e. You cannot declare variable here and use it in system variables. Also, if you declare a variable name common in System variables and User variables both will be used separately(DOS will merge them and use as one).

3. System Variable Window: This window will contain variables common to complete system without depending on how many users system has.

4. Creating New Variables: When we create new variable it can be accessed using command SET %VARIABLE_NAME% from DOS prompt. The benefit of using new variable and then using it in Path variable is that its easy to accommodate or embed new changes to same variables. Otherwise you can directly put the path in Path variable after the semicolon.

4. Examples

1. Using android ndk-build command.

for this you need to go to jni folder of your project and execute ndk-build.cmd command to compile and rebuild files. This can be done by keeping the location of your ndk-build.cmd (available in android-ndk folder root) to you Path variable directly or by declaing new variable NDK_HOME with value “location\of\your\ndk-directory”. and then adding %NDK_HOME%; to your Path variable.

2. Using adb, aapt in android.

since both of these are in different sub folders of android sdk. So either we can copy their respective paths to Path varible. or better approach is to mention new ANDROID_SDK variable and provide it location of sdk. then specifying in path %ANDROID_SDK%\tools; %ANDROID_SDK%\platform-tools;

There are many times when you will need providing value in your Path variable, for example jdk path for eclipse to run.

So, Hope you find this article informative and helpful. For any further solutions please leave a comment below and I will answer to it.

420 total views, 1 views today

Share this Onfacebook-6761235twitter-4037455linkedin-2114033google-8565661 Tags: example, path, path variable, setting ndk path, windows Path