Dim shl As Shell
Try
shl.Initialize("shl","java.exe", Array As String("-Xms1024m","-Xmx1024m", "-jar", "D:\test.jar"))
shl.WorkingDirectory="D:\"
shl.Run(-1)
Catch
Log(LastException.Message)
End Try
Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
If Success And ExitCode = 0 Then
Log(StdOut)
Else
Log("Error: " & StdErr)
End If
End Sub
And look what will be in the logs. If there's nothing, try setting timeout in shl.Run (instead of -1, set something like 3000, which is 3 seconds)
Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
If Success And ExitCode = 0 Then
Log(StdOut)
Else
Log("Error: " & StdErr)
End If
End Sub
And look what will be in the logs. If there's nothing, try setting timeout in shl.Run (instead of -1, set something like 3000, which is 3 seconds)
i set timeout to 3000 , i'm not sure if it reached to shl_ProcessCompleted ,
i got this error log:
java.lang.NoClassDefFoundError: anywheresoftware/b4j/objects/Shell
at b4j.example.main._timer3_tick(main.java:720)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:109)
at anywheresoftware.b4a.objects.Timer$TickTack$1.run(Timer.java:135)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: anywheresoftware.b4j.objects.Shell
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 14 more
Dim shl As Shell
Dim parms As List
parms.Initialize
parms.Add("-Xms1024m")
parms.Add("-Xmx1024m")
parms.Add("-jar")
parms.Add("test.jar")
shl.Initialize("shl","java.exe", parms)
shl.WorkingDirectory="d:/"
shl.Run(-1)
Wait For shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
If Success Then
Log("Success")
Log(StdOut)
Log(ExitCode)
Else
Log("Error: " & StdErr)
End If
Dim shl As Shell
Dim parms As List
parms.Initialize
parms.Add("-Xms1024m")
parms.Add("-Xmx1024m")
parms.Add("-jar")
parms.Add("test.jar")
shl.Initialize("shl","java.exe", parms)
shl.WorkingDirectory="d:/"
shl.Run(-1)
Wait For shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
If Success Then
Log("Success")
Log(StdOut)
Log(ExitCode)
Else
Log("Error: " & StdErr)
End If
i tried the above fragment , i got the error below ,
java.lang.NoClassDefFoundError: b4j/example/main$ResumableSub_timer3_Tick
at b4j.example.main._timer3_tick(main.java:707)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:109)
at anywheresoftware.b4a.objects.Timer$TickTack$1.run(Timer.java:135)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: b4j.example.main$ResumableSub_timer3_Tick
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 14 more
timer3 tick is where this fragment is executed . it used to run very well this way :
shl.Initialize("shl","java.exe", Array As String("-jar", "D:\test.jar"))
but problems arised when i added more arguments