B4J Question Where to put files?

HansDieter

Member
Licensed User
Longtime User
On my WindowsPC my code runs quite well but when i try to start it on my raspberry (useing the bridge), it terminates throwing a exeption:
B4X:
java.io.FileNotFoundException: /home/pi/tempjars/VintageTrain.jpg (Datei oder Verzeichnis nicht gefunden)
(File or folder not found)
the corresponding line of code is:
B4X:
    Image1.Initialize(File.DirApp,"VintageTrain.jpg")    ' Get image
The JPG sits in the projects OBJECTS subfolder

So my question is, where to place the files (in this case the JPG) so that it is included and available with the app?

Hans
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Remember that Linux file system is case sensitive. Make sure that the names are correct.
2. B4J-Bridge only copies files from the Files tab. You should put this image in the files tab (File.DirAssets).
3. You can use File.DirApp and copy the files yourself to the tempjars folder. This is required when you implement servers for example.
 
Upvote 0

HansDieter

Member
Licensed User
Longtime User
2. B4J-Bridge only copies files from the Files tab. You should put this image in the files tab (File.DirAssets).
This was the solution. Somehow i got a copy of the JPG in the Objects folder on my WinPC so it worked on this machine by chance with File.DirApp.
But after deleting the errand copy of the JPG it worked here too only doing it the correct way with File.DirAssets from the files tab.
 
Upvote 0
Top