Java threads don't start when called from C via JNI
1 posts in topic
Flat View  Flat View

Posted By:   Gregor_Schikorski
Posted On:   Wednesday, July 17, 2002 02:26 AM

I've written a C program that communicates with Java code via the Java Native Interface.

The program creates an instance of a Java class and then calls a method of this class instance.

The method includes the creation and the starting of a thread (actually an instance of a user-defined class that extends Thread).

When I run the C program, all works fine except the thread.

The method of the Java class is executed and prints some nice output but when the thread is to be started just nothing happens.
Can you tell me which steps I have to take in order to get the thread running ?

Thanks for your help !!!

Re: Java threads don't start when called from C via JNI

Posted By:   Alexander_Krapf  
Posted On:   Tuesday, July 23, 2002 04:50 PM


You have not supplied enough information to pinpoint the problem, but here are some potential issues:

  1. Are you creating the thread from the native side and if yes, are you attaching it to the JVM?
  2. If you are creating the thread on the Java side (I think that's what you're saying), it's likely not a JNI related issue but a bug in your Java code or a problem in your configuration (classpath is always a prime candidate).

Catch all exceptions that you can in your Java code, that might show you something.

If you're doing a lot of JNI or want a more robust solution, you should check out our JunC++ion product at www.codemesh.com.

Good luck,


About | Sitemap | Contact