Monday, December 20, 2010

Environment Variables

  How to set Environment Variables

 If user wants to compile and run java program, from any drives or from any location, then this is possible by setting Environment Variables. They are various environment variables, but the variables that are required are two as shown below:
1.   The classpath is an environment variable that tells the Java compiler javac.exe where to look for class files to import .
2.   The path is an environment variable that tells the command processor where to look for javac.exe and java.exe 
The Procedure is listed below:
Screen Shot 1: Right click on MyComputer icon, and go to the properties.



Screen Shot 2: Properties window gets opened go to the Advanced tab and click on it.


Screen Shot 3: After clicking on the Advanced tab, at the bottom side you see an option known as Environment Variable. Click on it.

Screen Shot 4: After clicking on it, the Environment Variable window gets opened and you can see two parts of the window, now click on New Button i.e. present at top side.
Screen Shot 5: After clicking on New Button, one window gets opened consisting of two text fields, one contains variable name and the other contains variable value. In variable name we have to write classpath and in place of value we have to write the path of lib folder of your java and after that click on OK button.
                          
    
This is the procedure to set environment variables, after that you can compile and execute the program any where.

No comments:

Post a Comment