Depending on jShell and @Erel 's sample i used this in both parts, here the "Re-Starter"
B4X:
Sub Process_Globals
End Sub
Sub AppStart (Args() As String)
Dim shl As Shell
Try
shl.Initialize("shl", "java.exe" , Array As String("-jar", "Your.jar"))
shl.WorkingDirectory = File.DirApp
shl.Run(-1)
Catch
Log(LastException.Message)
End Try
End Sub
Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
If Success Then
Log(StdOut)
End If
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
For all:
here the part from the Program that should be restartet.
Put the code in any event you like, i.e. Sub ExitButton_Click:
B4X:
Sub ExitButton_Click
Dim sf As Object = xui.Msgbox2Async("Proggi wird neu gestartet !","Neustart","OK","","Abbruch", Null)
Wait For (sf) Msgbox_Result (Result As Int)
If Result = xui.DialogResponse_Positive Then
Dim shl As Shell
Try
shl.Initialize("shl", "java.exe" , Array As String("-jar", "YourRestart.jar"))
shl.WorkingDirectory = File.DirApp
shl.Run(-1)
Catch
Log(LastException.Message)
End Try
Log("Neustart!!!")
ExitApplication
End If
End Sub
hello erel it is possible to have two executables (2 programs in the same project). I am trying for the client to have a program and when it detects an update, download and initialize again similar to Visual Studio's ClickOnce. I've searched the forum a lot and this is the most similar thing I find