Douglas Farias Expert Licensed User Longtime User Aug 9, 2015 #1 Hi all i m using this code to open another .jar file Code: Dim shl As Shell shl.Initialize("shl", "java", Array As String("-jar", "mega.jar")) shl.Run(-1) and this sub return only when i close the other .jar Code: Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String) Log(Success) If Success And ExitCode = 0 Then Log("Success") Log(StdOut) ExitApplication Else Log("Error: " & StdErr) End If ExitApplication End Sub how can i make a .run(-1) and later check if is runing the .jar (if sucesso) with .run(-1) comand then close the current .jar i have try with a try and catch Code: Try Dim sh1 As Shell sh1.Initialize("sh1", "java", Array As String("-jar", "mega.jar")) sh1.Run(-1) ExitApplication Catch log("error") End Try but this close the current .jar and dont open the mega.jar the event exitapplication execute first i think, and dont exist a doevents. how can i open another .jar and later this done close the current? Last edited: Aug 9, 2015
Hi all i m using this code to open another .jar file Code: Dim shl As Shell shl.Initialize("shl", "java", Array As String("-jar", "mega.jar")) shl.Run(-1) and this sub return only when i close the other .jar Code: Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String) Log(Success) If Success And ExitCode = 0 Then Log("Success") Log(StdOut) ExitApplication Else Log("Error: " & StdErr) End If ExitApplication End Sub how can i make a .run(-1) and later check if is runing the .jar (if sucesso) with .run(-1) comand then close the current .jar i have try with a try and catch Code: Try Dim sh1 As Shell sh1.Initialize("sh1", "java", Array As String("-jar", "mega.jar")) sh1.Run(-1) ExitApplication Catch log("error") End Try but this close the current .jar and dont open the mega.jar the event exitapplication execute first i think, and dont exist a doevents. how can i open another .jar and later this done close the current?
Erel B4X founder Staff member Licensed User Longtime User Aug 9, 2015 #2 shl.Run is an asynchronous method. You need to give it some time before you kill the process. The simplest way is to use a timer and kill the process after 3 seconds. Upvote 0
shl.Run is an asynchronous method. You need to give it some time before you kill the process. The simplest way is to use a timer and kill the process after 3 seconds.