Reputation: 2763
I am calling a java function in Delphi 7 using JNI. When start button click the java application loads and when stop button clicks the java application exits. But my problem is that when I click stop button, the java application and the delphi application exits. I need to exit the java application only and not the delphi application.
var
exit_code: Integer;
Runtime : TJavaRuntime;
begin
exit_code := 0;
Runtime.CallExit(exit_code);
end
Upvotes: 3
Views: 389
Reputation: 13327
Runtime.exit()
calls Runtime.halt()
which forcibly terminates the JVM process. Unfortunately the JVM (jvm.dll
) is running in the same process as your application, so the call of Runtime.exit()
terminates your application.
Upvotes: 4