B4J Question ExitApplication2 always give me -559038737

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi
Form my main application will lunch db.ProcessExecute("node4report.jar") but shl_ProcessCompleted always give me following message,Why ? :(

191154 ProcessCompleted(false,-559038737,,org.apache.commons.exec.ExecuteException: The stop timeout of 500 ms was exceeded (Exit value: -559038737))

B4X:
Sub ProcessExecute(ExeName As String) As Boolean  
   Dim shl As Shell
   Dim params As List: params.Initialize
   params.Add("/k")
   params.Add("start")
   If ExeName.ToLowerCase.Contains(".jar") Then
     params.Add("java")
     params.Add("-jar")
   End If
   params.Add(ExeName)
   ' shl.Initialize("shl",ExeName,Null)  
   shl.Initialize("shl","cmd",params)
   shl.WorkingDirectory = File.DirApp
   shl.Run(-1)  
   ' Run cmd /k java -jar <your jar>
End Sub

Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, so As String, se As String)
   dtlog($"ProcessCompleted(${Success},${ExitCode},${so},${se})"$)' Completed ")' & ExitCode & " " & so & " " & se)
End Sub

node4report.jar
n1=0,1,2 so ExitApplication2 will return 0 or 2
B4X:
Sub timer1_tick  
    Timer1.Enabled=False
    Timer1.Interval=5000
    If Items.Size>0 Then
        Dim n1 As Int=CheckUpdate(DateTime.now)
        If n1<>1 Then
            ExitApplication2(n1)
            Return
        End If
    End If
    Timer1.Enabled=True
End Sub
 

OliverA

Expert
Licensed User
Longtime User
The exit code and Standard Out and Standard Error message come from your node4report.jar application. Even though you have ExitApplication(n1) (where n1 can be 0 or 2) does not mean that this is where the application is exiting. If node4report.jar is exiting due to an error, you may get a different exit code then what you would expect. You may want to run node4report.jar separately and see how it behaves and what exit codes it gives out.

Clarification: I don't think ExitApplciation is giving you the exit code. There is an uncaught exception that is terminating the application and producing this exit code.
 
Upvote 0

jmon

Well-Known Member
Licensed User
Longtime User
I also have the same problem. Something that was working for years suddenly started giving me this error.

The jar file that I call was never changed. What could it be? New java SDK version?
 
Upvote 0
Top