ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkon...@mac.com
Subject System.loadLibrary() hangs on win2k cmd.exe console?
Date Sun, 28 Jul 2002 14:01:02 GMT
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>


Mime
View raw message