2

I have a book that says to do the following.

  1. Add a JAVA_HOME and ANT_HOME environment variable. - check
  2. Add $JAVA_HOME/bin and $ANT_HOME/bin to my path variable - check

When I then go to the command prompt and try ant -version it says ant is not a recognized command. If I then take the value I plugged into the ANT_HOME variable and use it in place of $ANT_HOME it all works. Is this the way it's supposed to work in windows? I'm not sure so I just figured that whatever was put in ANT_HOME was then parsed in the path variable when used as $ANT_HOME. Thanks.

geoff swartz
  • 5,437
  • 11
  • 51
  • 75
  • http://stackoverflow.com/questions/1672281/environment-variables-for-java-installation/31340459#31340459 – hitesh141 Jul 10 '15 at 12:12

4 Answers4

5

you can try the following:

SET ANT_HOME=my_path_to_ant_folder
SET JAVA_HOME=my_path_to_jdk_folder
SET PATH=%PATH%;%ANT_HOME%/bin;%JAVA_HOME%\bin;
Bogdan Emil Mariesan
  • 5,529
  • 2
  • 33
  • 57
  • I was going into environment variables and adding system variables. what you've shown looks like something I should be executing in a command window. Is that right? If so, I wonder if that's what they were wanting me to do all along. Thanks. – geoff swartz Mar 12 '12 at 20:05
  • yes you should type that in command window, and that's what was requested from that task in the book, for them it's usually easier to direct you towards the command prompt rather than adding them by "add env and system var" – Bogdan Emil Mariesan Mar 12 '12 at 20:08
4
  1. right click My Computer
  2. click Properties
  3. go to Advanced system settings
  4. click on Advanced tab
  5. click on Environment Variables
  6. click on New...

Now you can define an environment variable, type JAVA_HOME in Variable name and in Variable value the path to you JAVA_HOME, the same thing goes for ANT_HOME.

Amir Pashazadeh
  • 7,170
  • 3
  • 39
  • 69
2

$ANT_HOME doesn't mean $ANT_HOME, literally. $ANT_HOME means "the value of ANT_HOME".

If Ant is installed at c:\ant, your environment variables should be:

  • ANT_HOME=c:\ant
  • PATH = ...;c:\ant\bin;...

Same for JAVA_HOME.

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
0

Right click on My computer and select properties.

Click on Advance system settings.

Visit http://codebrizz.blogspot.com.ng/2016/07/installation-and-configuration.html for full configuration guide with images for each step

  • Welcome to Stack Overflow. Answers that rely on links are frowned upon. We ask that you include all of the relevant information directly in your answer. – Tyler Jul 24 '16 at 17:44