Csv does not exist or could not be read (application)

Hi !
My program is quite simple :

  Table base = loadTable("base.csv");
  println(base.getRowCount() + " total rows in table");

And it works well while running it from Processing.
The base.csv file is in the data folder (yes, I tried stuff like ‘loadTable(dataPath(“base.csv”))’)
When I export this program as an application (linux or macOSX), I have this error :

  base.csv does not exist or could not be read
  java.lang.NullPointerException: Cannot invoke 'processing.data.Table.getRowCount()' because 'base' is null

So it seems that the application is unable to find the file. It acts same with Processing 3 or 4.
Is there something I don’t get about the path ?
I’ve seet questions with the same error code, but not related to an exported application.




Set path inside sketch

Table base = loadTable("base.csv"); /// set path 
  println(base.getRowCount() + " total rows in table");

I’m not sure to get what’s different here !
Or you mean I shoud write the exact parth, like /home/id/sketches/sketch/data/base.csv ?

When the code is okay, can it be that the file has not been copied in the executable?


Maybe this help

There is a copy of the whole data folder (including the .csv file) coming wit the executable, so I guess it’s not it…

1 Like

Well it’s not the issue there, my csv is okay, and it works when I’m not exporting as an executable. I tried a few different path notations, except the absolute path, I’ll see if that works.
Just now I found an odd way : the csv ins in my pde file as as String wich I save then load…


Hello @Jean-no ,

Exporting and loading a table worked as expected on Ubuntu Linux on my system with Processing for Linux(Intel 64-bit).

Can you provide a reference or a simplified example?

I am aware of this reference:

I have another one somewhere… just can’t find it.


I’m not sure to understand what you mean (or not sure I explained myself very clearly, as english is not my native tongue). You mean that when you export your sketch as an application it has no difficulties finding the .csv file in the data folder ?

Yes. It was able to export the application and read the csv file in the data folder.


Ok. So the problem must be in the path or something… But weirdly, it’s the same problem wether I use Ubuntu, MacOS or Raspbian.

Hello @Jean-no ,

I am running Ubuntu in a VM in Workstation Pro.

Running the exported app works here.