Translate

Monday, February 11, 2013

Setting up JAVA_HOME and PATH environment variables in Windows 7

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.

9 comments:

#gone said...

True love doesn't happen right away; it's an ever-growing process. It develops after you've gone through many ups and downs, when you've suffered together, cried together, laughed together. See the link below for more info.

#gone
www.inspgift.com

lee woo said...

Love it! Very interesting topics, I hope the incoming comments and suggestion are equally positive. Thank you for sharing this information that is actually helpful.


ufgop.org
ufgop.org

andrea chiu said...


Time is one of the most precious and expensive thing in this world so value your time wisely because you can't flashback every wasted time at the past. Time is gold. Visit my site for more information.

triciajoy.com

www.triciajoy.com

Testing Sorttricks said...

Thanks for sharing your views dear.This is very usefull for me and to read about the How to setup the environment for JMeter

Cindy Dy said...

I enjoy reading your articles. You really have a wonderful blogs. Keep up the good work. Thank you also for the information!

Yong
www.gofastek.com

Kar Sho said...

for Video Solution, Youtube Link

shasthika said...

perfect explanation about java programming .its very useful.thanks for your valuable information.best java institute in chennai | best java training in velachery

vigneswaran said...

We share perfect explanation about java programming code and it's example.In this information very useful to me.Thanks for such a valuable information.
java training in chennai | java training

Mary Brown said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training India . Nowadays Java has tons of job opportunities on various vertical industry.