B4J Question How to shutdown jServer from code

b4x-de

Active Member
Licensed User
Longtime User
Hello,

I'm starting jServer by using a shell with this code:

B4X:
shServer.InitializeDoNotHandleQuotes("SvrStart", mstrJavaCmd, Array As String("-jar", Main.EXEC_SERVER))
shServer.WorkingDirectory = strDirSrv
shServer.Run(-1)

I'm currently using this code to shutdown a running jServer from code (inside a servlet handler):

B4X:
Dim jserver As JavaObject = srvr.As(JavaObject).GetField("server")
jserver.RunMethod("stop", Null)

It works - but is it the propper way doing a shutdown?

I can still see the process started the jar in TaskManager.

Thanks,
Thomas
 
Last edited:
Top