Normally when we are beginning to use Java, we find that we have to add the JAVA_HOME (the Java installation directory) to the Windows environment variables. Well, for that "first time" have given me the task of writing this little tutorial. For this tutorial we consider the following concepts:
Environment Variables
Autoexec.bat PATH : That is where the shell will look for the execution commands to write to the console, as long as not use a specific path to call the command.
The idea of \u200b\u200bOME JAVA_H is that we add a new environment variable to our system. In this case JAVA_HOME is the de facto name, but could be any other important thing is that in addition to be added to PATH for Windows to recognize the commands of Java. We could even not define the variable JAVA_HOME and do it all directly to the PATH variable, but by convention and convenience is better defined, this will be clearer as you continue to use Java.
To add the new environment variable there are two paths to follow.
The first is using the System Properties window of Windows.
(The way I always do)
1. Make the shortcut Home (the window key) + Pause to open the System Properties .

2. Within the Advanced tab , pressing environment variables, which will open a new window titled Environment Variables.

Note: Within the environment variables have the User Variables and System Variables , the first run while the user session is set for what is open, the others work for all user and administrator rights are needed to define them. Preferably I always use the System Variables , unless a special situation that requires use user variables.
3. In the section of the System Variables will Click on the button New , this will open a small dialog box add the following: * in the box
Variable Name: JAVA_HOME
* in the Variable Value box, the location where you installed the JDK In my case C: \\ Program Files \\ Java \\ jdk1.6.0_18 and click OK.

4. Find the system varible called Path and click Edit.
5. In the Variable Value field the Modify dialog system variable add our new environment variable value at the end of separate existence by a semicolon (;) As follows: ;% JAVA_HOME% \\ bin;

After these steps have to simply click the OK button in each window and we added our new environment variable.
Another way is to do it directly from the window line Command:
1. Make the shortcut Start + R to open the Run window, and write cmd and click OK. This will open a command line window.

2. In the command line window type: set JAVA_HOME =
Note: Quotation marks are not necessary unless you have spaces in our path, as in this case.
3. Later in the same window should add this variable to the Path in this way: September Path =% Path%,% JAVA_HOME% \\ bin;

This will have added the new environment variable, but only available remain open while session command line. To make permanent our variables otherwise appends to the Autoexec.bat can be loaded whenever you start the system.
Add environment variables in the AUTOEXEC.BAT
1. Open a Run window as in step one of the previous section and write sysedit and click on OK.
2. In the window add the lines AUTOEXEC.BAT @ echo off
JAVA_HOME =
Path =% Path%; % JAVA_HOME% \\ bin ;

And then save the file, preferably, the system restarts.
Note: Thanks to a comment, I note that in later versions of Windows ME environment variables must be added through the System Properties window and not by a change in the autoexec.bat file , although it is still possible.
test
To verify that truly added the new environment variable open a command prompt window and type java-version , and the result of executing this line should be something like this:

on DOS commands, the Autoexec.bat and general environment variables, I leave these links:
Environment Variables Environment variables
Autoexec.bat (English)
Autoexec.bat (English)
Config.sys and Autoexec.bat
How do I set or change the PATH system variable?
0 comments:
Post a Comment