Home > Archive > Java Help > August 2005 > Apache Ant environment variables problems (Win XP)
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Apache Ant environment variables problems (Win XP)
|
|
| jg.campbell.ng@gmail.com 2005-08-22, 7:04 pm |
| I have apache Ant working properly here on my home machine -- Windows
XP.
However in a university laboratory (networked) I have problems.
Possibly they are more related to Windows and associated than to Ant,
but maybe someone can see the problem.
We have set environment variables as follows:
- ANT_HOME is set to the name of the directory Ant is in, i.e. one
above the \bin;
- JAVA_HOME is likewise set to ... JDK;
- PATH has Ant's \bin in it;
- PATH has JDK's \bin in it;
These echo okay. java and javac work fine.
When we attempt to execute Ant, we get:
"ANT_HOME is set incorrectly or ant could not be located. Please set
ANT_HOME."
Possible source: there may be problems with /an/ ANT_HOME env. variable
coming from registry; i.e. the sys. admin. had ANT_HOME pointing to
Ant's \bin. But I got him to change that.
But unlikely, since before either of PATH or ANT_HOME had been set by
the sys. admin. I had managed to get Admin. privileges and set them
myself -- correctly I thought, at least similar to my working home
system.
Any ideas? I'm hardly the first to get such a message; as for the
phrase "... ant could not be located" -- what software /other than ant/
would issue such a message?
Incidentally, I'm a Linux user -- which explains all the command line
stuff.
TIA,
Jon C.
| |
| Daniel Dyer 2005-08-23, 3:57 am |
| > When we attempt to execute Ant, we get:
>
> "ANT_HOME is set incorrectly or ant could not be located. Please set
> ANT_HOME."
>
> Possible source: there may be problems with /an/ ANT_HOME env. variable
> coming from registry; i.e. the sys. admin. had ANT_HOME pointing to
> Ant's \bin. But I got him to change that.
>
> But unlikely, since before either of PATH or ANT_HOME had been set by
> the sys. admin. I had managed to get Admin. privileges and set them
> myself -- correctly I thought, at least similar to my working home
> system.
Is it possible that spaces in the path are causing problems? If there are
any spaces it might be worth changing the path to use the old 8.3 style
file names (e.g. C:\Progra~1\whatever instead of C:\Program
Files\whatever), or use quotes, or move the software to a path that
doesn't have spaces.
Dan.
--
Daniel Dyer
http://www.dandyer.co.uk
| |
| jg.campbell.ng@gmail.com 2005-08-23, 7:01 pm |
|
Daniel Dyer wrote:
>
> Is it possible that spaces in the path are causing problems? If there are
> any spaces it might be worth changing the path to use the old 8.3 style
> file names (e.g. C:\Progra~1\whatever instead of C:\Program
> Files\whatever), or use quotes, or move the software to a path that
> doesn't have spaces.
Nope, oddly enough, no spaces in paths -- for both JDK and Ant. On my
home machine at some stage, I did have Ant complaining about not being
able to understand JAVA_HOME (I think), which at that time was in
"Program Files".
I should have mentioned that fact.
Hmmm... 8.3? The only difference I can detect is that on my working
system, ANT_HOME is c:\apache-ant-1.6.5, whilst on the problem system
it is c:\Ant\apache-ant-1.6.5.
On a university networked system, maybe God only knows how meny
versions of system variables there are?
It's only first year stuff, but NB /not/ introdutory programming, so I
suppose I could flatten the directory structure and do without ant; but
the textbook uses ant; and it will be nice for them to get to know that
ant exists.
Many thanks,
Jon C.
| |
| Daniel Dyer 2005-08-23, 7:01 pm |
| On Tue, 23 Aug 2005 14:21:36 +0100, <jg.campbell.ng@gmail.com> wrote:
>
> Nope, oddly enough, no spaces in paths -- for both JDK and Ant. On my
> home machine at some stage, I did have Ant complaining about not being
> able to understand JAVA_HOME (I think), which at that time was in
> "Program Files".
I checked my path after posting that and realised that I do have spaces,
so that was unlikely to have been the problem.
What does "echo %ANT_HOME%" display?
> I should have mentioned that fact.
>
> Hmmm... 8.3? The only difference I can detect is that on my working
> system, ANT_HOME is c:\apache-ant-1.6.5, whilst on the problem system
> it is c:\Ant\apache-ant-1.6.5.
8.3 refers to the MS-DOS naming convention, where a file name could have
up to 8 characters before the dot and up to three afterwards (with no
spaces).
Dan.
--
Daniel Dyer
http://www.dandyer.co.uk
| |
| jg.campbell.ng@gmail.com 2005-08-25, 7:00 pm |
|
jg.campbell.ng@gmail.com wrote:
[...]
> When we attempt to execute Ant, we get:
>
> "ANT_HOME is set incorrectly or ant could not be located. Please set
> ANT_HOME."
Solved. ANT_HOME\lib contained no ant.jar file; in fact, I think
ANT_HOME\lib was empty.
If one looks at the batch file ANT_HOME\bin\ant.bat, one finds that it
is the absence of ANT_HOME\lib\ant.jar that causes the batch file to
emit the error message above. I knew that knowledge of batch file
programming would come in useful some time :-)
Dunno how the installation (ant-1.6.4) missed that out, but anyway the
problem is solved.
I must remember to switch my brain on the next time we have a problem
like that.
Best regards,
Jon C.
| |
| Roedy Green 2005-08-29, 9:56 pm |
| On Tue, 23 Aug 2005 09:36:21 +0100, "Daniel Dyer"
<dan@dannospamformepleasedyer.co.uk> wrote or quoted :
[color=darkred]
You can put your sets in a bat file you call prior to invoking ant.
Only once you have got them all perfect, hand them over to your admin
for burning into the registry.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
|
|
|
|
|