Scott Fraser wrote:
>As far as I can tell, in order to call Java from C or C++, it is required
>that the JavaVM be instantiated on a secondary thread.
Granted. My mistake for saying otherwise.
>Further, it appears that calls from the secondary thread to Java JNI
>functions will cause a transfer of control to the main thread.
It sounds like "transfer of control" is blocking the calling thread
(secondary) and then scheduling the main thread. If that's what's
happening, then that's an expected possibility for behavior, because the
JVM is multi-threaded.
Why the secondary thread would block, I don't know. If you can trigger a
full thread dump, that may be informative. The QUIT signal might do that
('kill -QUIT pid'), but I don't know if that's available in a JVM
invocation situation.
In order to offer further suggestions, I think we'll have to see your
source code. Even then, there may be no solution to what you want.
Another strategy is for you to create a minimal working JVM case and expand
it. That is, start simple and work up, rather than starting with Carbon
Events and working down. That still may not succeed, as a Carbon app with
a 1.4 JVM is unsupported.
>If the main thread is blocked (for example, "MPWaitOnQueue") waiting for
>the Java task to complete, the app hangs.
Sounds like deadlock. Main is waiting for secondary, and secondary is also
waiting for main. Why the latter would be happening I don't know. I
suspect only a thread-dump or some time with gdb will show why.
>If the main thread has any event processing initiated
>(for example "RunApplicationEventLoop") the app crashes.
Try a headless AWT to see if it makes a difference. I'm just guessing, and
promising nothing; it's just a suggestion. Search archives for "headless"
for how to accomplish that.
If it still fails, also see Matt Drance's cited reference on Carbon-Cocoa
integration. Again, just guessing, and no promises.
>Is there any way for a C or C++ application that is already processing
>Carbon events to successfully make a call of any kind to a method in a Java
>jar file?
Matt Drance wrote:
<http://lists.apple.com/archives/java-dev/2006/Jan/msg00063.html>
"... Apple does not support invocation of a 1.4+ JVM from Carbon..."
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden