This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with Java and stdout in newest snapshot


Hi ,

Using the newest snapshot cygwin1-20000108.dll in my Java JNI
application solved my problem with segmentation faults in function
ioctl.

But now I'm running into a new problem:As soon, as the jni-dll is loaded
from my Java-Program, the Java standard output (System.out.println) does
no longer work. This bug does not appear with the originalB20.1
cygwin.dll.

To demonstrate the bug I changed the Java code from the java-jni  c++
example:

Main.java
========

class Main {
    public static void main(String[] args) {
       System.out.println("*** main START ***"); // !!!
       new HelloWorld().displayHelloWorld();
       System.out.println("*** main END ***"); // !!!
    }
}

HelloWorld.java
============

class HelloWorld {
    public native void displayHelloWorld();

    static {
        System.out.println("*** load hello.dll ***"); // !!!
        System.loadLibrary("hello");
        System.out.println("*** hello.dll loaded ***"); // !!!
    }
}


Running this with the original cygwin1.dll gives the following correct
output:

*** main START ***
*** load hello.dll ***
#1 LocalFoo created.
*** hello.dll loaded ***
HelloWorld::displayHelloWorld: Entering.
#2 LocalFoo created.
#3 LocalFoo created.
#3 LocalFoo destroyed.
HelloWorld::displayHelloWorld: Leaving..
#2 LocalFoo destroyed.
*** main END ***
#1 LocalFoo destroyed.

Running the same program with cygwin1-20000108.dll:

*** main START ***
*** load hello.dll ***
#1 LocalFoo created.
HelloWorld::displayHelloWorld: Entering.
#2 LocalFoo created.
#3 LocalFoo created.
#3 LocalFoo destroyed.
HelloWorld::displayHelloWorld: Leaving..
#2 LocalFoo destroyed.
#1 LocalFoo destroyed.

The lines *** hello.dll loaded *** and *** main END *** are missing.

Any help would be greatly appreciated.

Klaus Schröder




--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]