ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject Re: System.loadLibrary() hangs on win2k cmd.exe console?
Date Mon, 29 Jul 2002 14:46:52 GMT
Rereading the original post I doubt that this is your
exact problem, by your use of System.in, but the
information below is still valid.

-Matt

--- Matt Benson <gudnabrsam@yahoo.com> wrote:
> I would have no trouble believing that your problem
> is
> related to the Windows command line.  I have
> observed
> that the behavior of the Windows standard input
> stream
> seems consistent with the use of a buffer of limited
> size.  Java applications that read from System.in
> hang
> on Windows but not on Unix.  All that is needed to
> solve this problem, however, is some threading. 
> Just
> create a Thread that continues to pull the contents
> of
> System.in and your program should no longer hang.
> 
> -Matt 
> 
> 
> --- kkonaka@mac.com wrote:
> > hi,
> > 
> > when I run a program like below on windows 2000,
> and
> > under Ant running under plain vanilla cmd.exe
> prompt
> > line, the program hangs within
> System.loadLibrary()
> > line (if the readLine() is going on at the same
> > time).
> > does anybody else observed similar behavior?
> > 
> > additionals:
> > - it surely happens on 1.3.1_04 (also appears to
> be
> >   the same on all of 1.3.{0,1}*, 1.4.*).
> > - same program and ant combination on windows 98
> >   (or on unix variants) runs happily without any
> > problem.
> > - windows 2000 tested have *no* service packes
> > applied.
> > - not yet tested on windows XP.
> > - the program runs happily if launched via a batch
> > file
> >   and not from ant.
> > - the JNI lib loaded defines only trivial single
> > line functions.
> > 
> > (I'm thinking about something like stdio
> redirection
> > problems specific to DOS console programs, but so
> > far
> > couldn't find any hits on windows or java
> > bugparades).
> > 
> > regards,
> > kenji
> > --
> > import java.io.IOException;
> > import java.io.DataInputStream;
> > 
> > public class Win2kHang {
> >   public static void main(String[] args) throws
> > Exception {
> >    
> >
>
System.out.println(System.getProperty("java.version"));
> >     fork_listener();
> >     System.out.println("loading...");
> >     System.loadLibrary("someJNIlibrary");
> >     System.out.println("done");
> >   }
> >   static void fork_listener() throws Exception {
> >     Thread t = new Thread() {
> >         final String prompt = "> ";
> >         final DataInputStream in = new
> > DataInputStream(System.in);
> >         public void run() {
> >           try {
> >             System.out.print(prompt);
> >             System.out.flush();
> >             String r = in.readLine();
> >             System.out.println(r);
> >           }
> >           catch (IOException e) {
> >             e.printStackTrace(System.out);
> >           }
> >         }
> >       };
> >     t.setDaemon(true);
> >     t.start();
> >     // wait heuristically, but long enough before
> > readLine() starts
> >     Thread.sleep(200);          
> >   }
> > }
> > --
> > 
> > --
> > To unsubscribe, e-mail:  
> > <mailto:ant-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:ant-user-help@jakarta.apache.org>
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - Feel better, live better
> http://health.yahoo.com
> 
> --
> To unsubscribe, e-mail:  
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message