Monday 7 January 2008

When Apache Ant does not recognise JAVA_HOME environment variable

Argh, so again, I had to spend more than 2 hours in a wild goose chase.

I was trying to install Apache Ant 1.7 on my machine, and it just wouldn't recognise the right path (JAVA_HOME). It kept on failing to locate tools.jar file which should be found by Ant if Ant correctly used JDK path. But it kept on using JRE! I tried uninstalling and re-installing JDK again and again to no avail. It was driving me nuts, literally! seriously!

In the end, I finally found a useful help on the Java forum site (and it wasn't easy to find).
check if there's a java.exe and/or javaw.exe and/or javaws.exe in your Windows or Windows/System32 directory.
If there is, remove them.

Sometimes/often installers will put them there but subsequent installers not overwrite them.

Fixed my problem instantly. Stupid installer!

2 comments:

Anonymous said...

I didn't really understand any of that, but I will try to nod my head and pat your back in mock-sympathy.

Nordlysbyen Alta said...

Thank you for posting this. I had the exact same problem, unfortunatly I spent more than a few hours trying to figure this out.