ant error "The syntax of the command is incorrect." on running ant.bat
Asked Answered
M

3

5

I tried various ant versions and also tried running the command directly from ant_home/bin directory, but no luck only below error:

ant error "The syntax of the command is incorrect." on running ant.bat

kindly help on this, I am not finding anything helpful anywhere on the web.

Thanks

Marmoset answered 31/3, 2015 at 6:26 Comment(1)
Welcome to stackoverflow. We cannot help you with syntax of a command if we do not see it. Please edit your question and paste the failing command (and format it properly, see {} code button above edit field).Cantillate
M
14

Luckily I got the problem root cause and solved it :)

The reason was my java_home was ending with a " character in environment variable, after removing the " from java_home path, ant started working as expected.

to investigate the aforesaid I just opened the ant.bat in notepad and in the first line I changed echo "off" to echo "on", by doing that, when I hit ant.bat in the command prompt it logged the exact line of ant.build file where the aforesaid error was being thrown.

Marmoset answered 31/3, 2015 at 6:44 Comment(0)
M
0

I have JAVA_HOME set with proper path but it was pointing to JDK 1.8. I need to change it to point to JDK 1.6 in order to resolve the issue.

Monosymmetric answered 28/4, 2016 at 8:20 Comment(1)
I shared what worked for me. Its not necessary that everyone has same cause of the problem.Monosymmetric
P
0

The ANT_HOME and JAVA_HOME environment variables are configured in some user machines with "" surrounding the paths, to overcome the spaces in the folder paths.

Having the folder paths with "" around them could be the reason for the message. Either the quotes are to removed or the multiple paths are to separated by ";"

Ref : https://www.mail-archive.com/[email protected]/msg37855.html

Pyriform answered 26/7, 2018 at 10:46 Comment(1)
add some relevant explanation to your post.Bergstrom

© 2022 - 2024 — McMap. All rights reserved.