Friday, October 9, 2009

Java - setting environmental variable

Definitions:
    PATH :- It points to the bin directory of the application where all the jar files are available to execute
    CLASSPATH :- It points to the tools directory

1. Setting environment variable on Windows
    Setting PATH for Microsoft Windows NT, 2000, and XP operating systems :
    1.  Click Start -> Settings -> Control Panel -> System.
         For Microsoft Windows NT select the Environment tab;
         for Microsoft Windows 2000 select the Advanced tab and then Environment Variables
         Look for "Path" in the User Variables and System Variables. If you're not sure where to add the path, add it to the right end of the "Path" in the User Variables.                  Example:- C:\Program Files\Java\jdk1.6.0_12\bin (its not case sensitive)

        The PATH can be a series of directories separated by semi-colons (;). Microsoft Windows looks for programs in the PATH directories in order, from left to right.
        You should only have one bin directory for a JDK in the path at a time (those following the first are ignored).

    2. The new path takes effect in the new Command Prompt window opened after setting PATH variable.
        JAVA_HOME should be set to the home folder of your JDK - ex C:\Program Files\Java\jdk1.6.0_06
    
2. Setting environment variable on Linux
    PATH should include "%JAVA_HOME%\bin" for Windows or $JAVA_HOME/bin for Linux / Unix
    Depending on whether or not JAVA_HOME contains any spaces you'd want to put the entire path, including the \bin, in quotes.

No comments:

Post a Comment