B4J Question Jshell, is runing event

Douglas Farias

Expert
Licensed User
Longtime User
Hi all

i m using this code to open another .jar file

B4X:
   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
B4X:
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
B4X:
            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:
Top