how to get exit code from JNI

Hi, All

in my project, i need to call a java method from C code using JNI, yet I do

not know how to

retrieve the exit code of java program. the java code is like below

....

public static void main(....)

{

.....

if(error){

System.exit(-77);// the exit code is -77

....

}

and the JNI c code may like below

.....

/* Invoke main method. */

(*env)->CallStaticVoidMethod(env, mainClass, mainID, mainArgs);

//here I want to retrieve the exit code from java to check if there is an

error

...

--

any suggestions? thanks

[642 byte] By [Lyona] at [2007-10-3 0:32:43]
# 1

You can't.

When exit is called the application, which includes your C code, exits. It is never going to return to your method.

> any suggestions?

1. Don't use JNI. Start the app in a process space and collect the result from that.

2. Modify the java code so it doesn't call exit()

jschella at 2007-7-14 17:26:10 > top of Java-index,Java HotSpot Virtual Machine,Specifications...