hello everyone,
Here is a slightly improved code that allows you to restart the application at any time:
code source by @byz:
Here is a slightly improved code that allows you to restart the application at any time:
code source by @byz:
Main Form::
#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 880
#PackagerProperty: ExeName = Your.exe
' #IgnoreWarnings:
#End Region
B4XMainPage::
Private Sub Button1_Click
RestartSelf("Your.exe")
End Sub
Private Sub RestartSelf(exeName As String)
Try
' shl.Initialize("shl", "java.exe", Array As String("-jar", exeName)) 'Your.jar
shl.Initialize("shl", "cmd.exe", Array As String("/c", exeName)) 'Your.exe
shl.WorkingDirectory = File.DirApp
shl.Run(-1)
Catch
Log(LastException.Message)
End Try
Sleep(0)
ExitApplication
End Sub
Last edited: