What are the environment variables?
Environment variables are global system variables accessible by all processes running under the operating system (OS).Environment variables are useful for storing values of the entire system, such as directories to search for executable programs (PATH) and the version of the operating system. Examples of environment variables in the Windows operating system are:
- COMPUTENAME, USERNAME: stores the computer name and current user.
- OS: the operating system.
- SystemRoot: the root directory of the system.
- PATH: stores a list of directories to search for executable programs.
In creating JDK and Java applications, you will find these environment variables: PATH, CLASSPATH, JAVA_HOME and JRE_HOME. In summary:
- PATH:maintains a list of directories. The operating system searches the entries path for executables, such as Java (javac) time compiler and Java (Java) implementation programs.
- CLASSPATH: maintain a list of directories (which contain many of Java class files) and the JAR file (a single Java class file). The Java compiler and Java Runtime searches the CLASSPATH entries to the Java classes referenced in your program.
- JAVA_HOME and JRE_HOME: keep the location of JDK and JRE installed directory, respectively.
Setting the Path in windows 8
- Assuming you have installed Java in c:Program Filesjavajdk directory
- Right-click on ‘My Computer’ and select ‘Properties’.
- Click on the ‘Environment variables’ button under the ‘Advanced’ tab.
- Now, alter the ‘Path’ variable so that it also contains the path to the Java executable. Example, if the path is currently set to ‘C:WINDOWSSYSTEM32′, then change your path to read ‘C:WINDOWSSYSTEM32;c:Program Filesjavajdkbin’.
Setting by command prompt
- Open the Command Prompt .
- Type “set Path=C:Program FilesJavajdk1.6.0_21bin”
- Type ” set HomePath= C:Program FilesJava jdk1.6.0_21 “
No comments:
Post a Comment