Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / August 2005

Tip: Looking for answers? Try searching our database.

Apache Ant environment variables problems (Win XP)

Thread view: 
jg.campbell.ng@gmail.com - 22 Aug 2005 18:30 GMT
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 - 23 Aug 2005 09:36 GMT
> When we attempt to execute Ant, we get:
>
[quoted text clipped - 9 lines]
> 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.

Signature

Daniel Dyer
http://www.dandyer.co.uk

jg.campbell.ng@gmail.com - 23 Aug 2005 14:21 GMT
> > When we attempt to execute Ant, we get:
> >
[quoted text clipped - 15 lines]
> 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 - 23 Aug 2005 17:36 GMT
>> Is it possible that spaces in the path are causing problems?  If there  
>> are
[quoted text clipped - 7 lines]
> 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.

Signature

Daniel Dyer
http://www.dandyer.co.uk

Roedy Green - 30 Aug 2005 01:04 GMT
>> 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.

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.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

jg.campbell.ng@gmail.com - 25 Aug 2005 15:38 GMT
[...]
> 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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.