I use the following code to test jShell for fswebcam :
A couple of times it worked, but suddenly File.Exists returned false, whereas the file really exists and is listed e.g. by rasbian File Manager. When the result is not correct executing the program reports that the fswebcam program cannot be found with the message:
Error: org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "\usr\bin\fswebcam" (in directory "."): CreateProcess error=2, Het systeem kan het opgegeven bestand niet vinden)
What can be the cause of this behaviour?
Harry
B4X:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
End Sub
Sub AppStart (Args() As String)
Dim shl As Shell
If File.Exists("/home/pi/MyApps/Domo","Webcam.jpg") = True Then
File.Delete("/home/pi/MyApps/Domo","Webcam.jpg")
End If
shl.Initialize("shl", "/usr/bin/fswebcam", Array As String("-r 800*600"," -s 2","--no-banner", " /home/pi/MyApps/Domo/Webcam.jpg"))
shl.Run(10000) 'set a timeout of 10 seconds
StartMessageLoop 'need to call this as this is a console app.
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
A couple of times it worked, but suddenly File.Exists returned false, whereas the file really exists and is listed e.g. by rasbian File Manager. When the result is not correct executing the program reports that the fswebcam program cannot be found with the message:
Error: org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "\usr\bin\fswebcam" (in directory "."): CreateProcess error=2, Het systeem kan het opgegeven bestand niet vinden)
What can be the cause of this behaviour?
Harry