I recently had to do some load testing stuff using the Apache Jmeter tool.Its a java based load testing tool.So for this i was required to install JDK on my Win7 box.Installing JDK was easy.But that was not all.
Since i am not much into programming in Java (am a .NET enthusiast fyi),so i was told by one of my friends to set the environment variable to enable java to execute jar files for the load testing tool.Well it was not a tough job but took some time for me to figure it out.So here's a short and smart tutorial to get your box Java ready.
Step 1: Where's my JDK installation
The first step would be to locate your jdk's installation folder on your hard drive.Mine was C:\Java.This is an important step.You need to know the jdk installation folder location.This will be required later.
Step 2: Setting up environment variable.Where do i begin?
To set up the environment variable,right click on the 'My Computer'(or 'Computer' icon/menu item in Win 7)
This would show up the following screen.
Notice the 'Advanced system settings' on left!! Click on it.
This would throw up a new mini-window with the 'System properties' options.
Now locate and click the button which says 'Environment Variables'.
This shows up the EV window where you have a couple of system related variables pre-defined.
Step 3: Setting up things
Now,our concern is to set up two new variables namely JAVA_HOME and PATH.We define the variables individually.Click on the 'New' button(Note there are two buttons with the text New.Click on the highlighted one in the image.)
This throws up a small-window with couple of textboxes. Here is where you specify the two attributes of your variable,the Variable Name and Variable value. In the Variable Name field you need to specify the name of the variable(JAVA_HOME or PATH in our case) and in the Variable value field,you need to specify the pathname.
For JAVA_HOME put in these parameter values.Note: The Variable value should contain the location of the JDK folder on your system.
For PATH put in these values.Note: The Variable value should contain the location of the bin folder of the JDK installation on your system.
Once done, you can see these environment variables in the listing. But we are not done yet.
Step 4: Some more changes
We just specified the environment variables.But the job is not over yet.We need to edit some 'System Variables' for the JAVA_HOME variable.To do so,highlight the JAVA_HOME variable by clicking on it.Once highlighted,you can see the various system variables related to our variable.
Now,we need to change the 'Path' variable(highlighted in the image above).Click on it and then click on 'Edit'.
This throws up the 'Edit System Variable' mini-window.Now add the highlighted portion in the image shown below at the end.(Don't forget to put in the semi-colon).
Once done,close everything and restart your system for the changes to come into effect.Once restarted,go to the command-line(cmd.exe) and type-in the following commands: java and javac
You can see the version of Java installed on your system.This indicates that you have set the 'environment variables' successfully on your system.










