• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ANT - and was unexpected at this time.

 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello everyone,

i am not an experienced person using ant, but have done a few projects using ant to build.
Upto my knowledge ant must be either provided the specific target in our build.xml or run the ant directly in build.xml without any argument.

But now I am facing a peculiar error which i get when i run ant

and was unexpected at this time


i am stuck why would such a message come around?
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you run ANT with the -x flag? Should give you further info.
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what ever the option i pass it gives me the same error

and was unexpected at this time


and more over it is the same even in the location where buil.xml is not present.
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What command are you using? Have you checked in an XML editor that your build.xml is valid?
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my build files are valid because the ant integrated into IDE is working fine for this build files.
I am facing the error when i am running from a command prompt.

 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interesting, can you post the command you are using to run the build?
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Martijn Verburg
so did you go through the changes i have made to my previous post, i have added a snapshot of the error screen.
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm, haven't seen that before, is your ANT_HOME and JAVA_HOME set correctly? Also does your build.xml file have a default target?
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes ofcourse earlier i have sucessfully build my application in the same way & now i am facing this error without changing anything to my path variables.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please post you build script. As far as I can tell from the error the term 'and' is appearing in an unusual location. Also, post the full command line you entered and all of the output that was generated (copy and past the whole thing from the command line to the forum).
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is what i get, what else you want me to give.

in case if the above image does not work.


C:\Documents and Settings\Stubati>dir build.xml
Volume in drive C has no label.
Volume Serial Number is E410-81E4

Directory of C:\Documents and Settings\Stubati

03/08/2010 05:36 PM 4,336 build.xml
1 File(s) 4,336 bytes
0 Dir(s) 16,883,073,024 bytes free

C:\Documents and Settings\Stubati>ant
and was unexpected at this time.

C:\Documents and Settings\Stubati>

 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post your default task in the build.xml here?
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what ever the build file i use or which ever the target i give to the command ant, it is just throwing the message

and was unexpected at this time.



actually i am able to run the file properly through my IDE, but when i do it directly in a command prompt i am facing the error.
I tried even to remove the existing ant binaries and downloaded the new ones but still i am getting the same.
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you get when you type "ant -version" from your shell?
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
same message.
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You better first check your Ant installation, looks like an issue with the shell interpreter. Check the PATH, ANT_HOME, JAVA_HOME environment variables again. Post the content of those here.
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


If there is any problem with them then the ant should state some error like windows stating that ant is not recognized as internal or external command.
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What about PATH? And have you try running "ant -version" from the bin directory of ANT_HOME (assuming your installation is correct)?
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vijitha Kumara wrote:And have you try running "ant -version" from the bin directory of ANT_HOME (assuming your installation is correct)?


yes i have done that as well but no luck.
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

yes i have done that as well but no luck.


What's the error you got, same as before ? Just to make sure, What you get when you type "java -version" in the shell? And what's the directory structure inside the ANT_HOME?

If this doesn't work either, best thing would be to start fresh, get the latest Ant installed (follow the instruction accordingly, to make sure you haven't missed any) and try from there...
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here are the different versions i get for java , ant, maven


C:\Documents and Settings\Stubati>java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)

C:\Documents and Settings\Stubati>ant -version
and was unexpected at this time.

C:\Documents and Settings\Stubati>mvn -version
Apache Maven 3.0 (r1004208; 2010-10-04 17:20:56+0530)
Java version: 1.6.0_17
Java home: C:\Program Files\Java\jdk1.6.0_17\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"

 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vijitha Kumara wrote: If this doesn't work either, best thing would be to start fresh, get the latest Ant installed


I posted here about the issue only after i make sure that i made a new installation by downloading the latest binaries.
this is my ant folder structure.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ant is run via a batch file named ant.bat. Apparently someone edited that file and screwed it up. Either fix it, or reinstall ant. Another possibility is env var settings - if any JAVA_HOME has quotes then that could cause issues. The best way to find out the exact issue is edit ant.bat and comment out the "@echo off" at the start of the file, then when you run ant it will echo all of the command in ant.bat until it hits the place where it was messed up.
 
saipraneeth nallapareddy
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@ Peter Johnson
What a great point

Peter Johnson wrote: The best way to find out the exact issue is edit ant.bat and comment out the "@echo off"


It did helped me where i made the mistake, it was the variable CLASSPATH which contains "" and that's where it messed up the whole thing.
ThankQ
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Never set the CLASSPATH env var, it will only lead to problems!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic