B4J Question Run a .exe File with jShell

Cal4th

Member
I am trying to run a .exe application with a button. The app is located in the Object Folder of the B4J file. When I click the button the app doesn't start and it doesn't appear any error in the logs it just doesn't start. the code im using is below.
B4X:
    Dim xfoil As Shell
    Dim params As List: params.Initialize
    Dim FileRun As String
   
    params.Add(File.DirApp)
    FileRun= File.Combine(File.DirApp , "xfoil.exe")
    Log(FileRun)

    'xfoil.Initialize("xfoil",FileRun, Null)
    xfoil.Initialize("xfoil",FileRun, params)
    xfoil.WorkingDirectory = File.DirApp
    xfoil.Run(-1)
In the Log it appears correctly the FileRun
 

Cal4th

Member
I couldn't understand how did it work and how to define it. I did fined how to define it in the explanation of jShell, and when I use the example given, it does the same.
this is the code with the ProcessCompleted Event:
B4X:
Sub btnRun_MouseClicked (EventData As MouseEvent)
    
    Dim xfoil As Shell
    Dim params As List: params.Initialize
    Dim FileRun As String
    
    params.Add(File.DirApp)
    FileRun= File.Combine(File.DirApp , "xfoil.exe")
    Log(FileRun)

    'xfoil.Initialize("xfoil",FileRun, Null)
    xfoil.Initialize("xfoil",FileRun, params)
    xfoil.WorkingDirectory = File.DirApp
    xfoil.Run(-1)

End Sub

Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
    If Success And ExitCode = 0 Then
        Log("Success")
        Log(StdOut)
    Else
        Log("Error: " & StdErr)
    End If
    ExitApplication
End Sub
Hope it is useful to help me solve the question.
 

Cal4th

Member
I changed it and it gives me other error.

B4X:
Sub btnRun_MouseClicked (EventData As MouseEvent)
    
    Dim xfoil As Shell
    Dim params As List
    Dim FileRun As String
    params.Initialize
    params.Add(File.DirApp)
    FileRun= File.Combine(File.DirApp , "xfoil.exe")
    Log(FileRun)

    'xfoil.Initialize("xfoil",FileRun, Null)
    xfoil.Initialize("xfoil",FileRun, params)
    xfoil.WorkingDirectory = File.DirApp
    xfoil.Run(-1)

End Sub

 Private Sub xfoil_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
    If Success And ExitCode = 0 Then
        Log("Success")
        Log(StdOut)
    Else
        Log("Error: " & StdErr)
    End If
    ExitApplication
End Sub
Error: At line 135 of file ../src/userio.f (unit = 5, file = 'stdin')
Fortran runtime error: End of file
 
Top