ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter DePasquale" <>
Subject Re: Output Beffuering Question - text-based application execution via ant
Date Thu, 09 Nov 2006 01:37:46 GMT
Thanks, but it didn't.

Through a series of method calls, I print a few welcome strings to the
console (text-based application), and then open a Scanner on the,
print a prompt and wait for string input.  It appears that the program hangs
when run through ANT, but if you were to CTRL-C and "terminate the batch
job", you get:

C:\Documents and Settings\Peter\Desktop\ch11>ant run
Buildfile: build.xml




     [java] Welcome to the JF Mail Reader.
     [java] Attempting to connect to: using the pop3s

     [java] java.util.NoSuchElementException: No line found
     [java]     at
     [java]     at
     [java]     at
     [java]     at
     [java]     at
     [java]     at
     [java]     at
     [java]     at
     [java]     at
     [java]     at
     [java]     at
     [java]     at
     [java]     at
     [java]     at
     [java]     at
     [java]     at

Right at that multi-blank line, the program is waiting for the user to enter
the hostname to connect to, but the prompt to do so is never displayed.  Why
would this be?  How can I get around it?  It's driving me up a wall to think
that I can't use ANT to run the program due to some issue related to input
reading.  Could it be the Scanner?


On 10/15/06, Martin Gainty <> wrote:
> Peter
> Ant uses java. Java depends on the underlying OS resources such as Socket
> I/O handles, File I/O handles as well as standard handles such as
> stdin,stderr and stdout
> flush the output from the java class to the resource and closing the
> connection allows the underlying resource to capture the output and render
> the output
> HTH,
> Martin
> This e-mail communication and any attachments may contain confidential and
> privileged information for the use of the
> designated recipients named above. If you are not the intended recipient,
> you are hereby notified that you have received
> this communication in error and that any review, disclosure,
> dissemination, distribution or copying of it or its
> contents
> ----- Original Message -----
> From: "Peter DePasquale" <>
> To: <>
> Sent: Sunday, October 15, 2006 8:59 AM
> Subject: Output Beffuering Question - text-based application execution via
> ant
> > I'm sure this is a common issue, but I can't seem to find an
> > answer/explanation for it.
> >
> > I'm teaching my students ANT in their programming course.  We use only
> > text-based System.out/Scanner( I/O in this course.
> >
> > I am finding that in student programs which require user interaction
> > (application prompting followed by user input) the prompting seems to be
> > buffering until the ant execution task (<java>) is completed.
> >
> > Is there a clear, easy way to have user interaction co-exist with ANT
> such
> > that my students can use ant for execution purposes?  I recall a few
> years
> > ago we used to be able to do this, but it seems that the situation is
> now
> > changed.
> >
> > There is no problem grabbing the input when the user provides
> it.  However,
> > the problem only seems to be that the output is buffered.  Thus, the
> > students don't see the prompts from their program.  If the user knows
> what
> > to enter and when, all will execute perfectly.
> >
> > Currently they use a run target in a form similar to:
> >  <target name="run" depends="compile" description="execute the
> > application">
> >    <java classname="Project1"/>
> >  </target>
> >
> > Thanks.
> >

Peter J. DePasquale, Ph.D.                      238 Holman Hall
Department of Computer Science        The College of New Jersey
PO Box 7718                                Ewing, NJ 08628-0718
===============================================================                  (p) 609-771-2806
(e) depasqua [at] tcnj [dot] edu                  (f) 609-637-5190

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message