3

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
1
  • 2
    Looks like java.lang.System.exit() is terminating the process too. Commented Jun 28, 2011 at 8:19

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.