how to avoid JNI_CreateJavaVM to exit.

Hi,

using W2K with JDK1.3.01.

I have a C (in fact Objective C) program that creates a JVM using JNI_CreateJavaVM. I encountered a case where this function stop my program when a problem occurs (which is when I try to launch in remote debug mode, and it cannot find dlls for this.)

This is a big issue for me, as the expected behavior of my application in this case, is to invalidate any Java-dependant feature, not to quit silently.

(moreover, my belief is that it is a bad design in a function in a library to decide to kill the app in case of error : this is a decision that can be taken by no-one but the app designer itself).

How can I prevent the JVM to quit my app in any case, but instead to send back an error code ?

C.Dore

[788 byte] By [cdore] at [2007-9-26 14:19:40]
# 1

What makes you think the code is doing this?

If windows can load a 'statically' linked dll then it stops the application. The only way around this is to load the dll 'dynamically'. This involves doing about the same steps that java reflection does - load it, create pointers, use pointers for the actual function calls.

jschell at 2007-7-2 15:56:20 > top of Java-index,Java HotSpot Virtual Machine,Specifications...