B4J Question java.io.FileNotFoundException error

328230795

New Member
Licensed User
I ran into a problem.

Debugging can skip this problem, but after releasing the problem will end the process.
B4X:
java.io.FileNotFoundException: C:\Users\MBENBEN\AppData\Local\Temp\360
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:371)
    at b4j.example.httputils2service._hc_responsesuccess(httputils2service.java:62)
    at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.BA$4.run(BA.java:196)
    at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
    at java.lang.Thread.run(Thread.java:745)
 
Last edited:

Daestrum

Expert
Licensed User
Longtime User
If you put the file open in a Try ...Catch block you can handle the error yourself instead of the program crashing.
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Are you trying to open a file that has been downloaded ?

Chances are you are trying to read it before the temp file is written to disk.
Try using file.Exists to ensure it has been written before attempting to open it.
 
Upvote 0

328230795

New Member
Licensed User
Are you trying to open a file that has been downloaded ?

Chances are you are trying to read it before the temp file is written to disk.
Try using file.Exists to ensure it has been written before attempting to open it.
Thank you. I think I found the problem.
 
Upvote 0
Top