Export application with json file fail

hi i do a simple project .
works fine when i push play in processing 3.0
when i do push EXPORT application and make windows and embed java i get the files exported.
But when trying to rin the exe file …it show the window but no text …
How to export application when using a json file in the project ?

******************* the pde file

JSONObject json;

void setup() {

  json = loadJSONObject("data.json");

  int id = json.getInt("id");
  String species = json.getString("species");
  String name = json.getString("name");
  textSize(12);
  text(id, 10, 10); 
  text(species, 10, 20);
  text(name, 10, 30);
}

************ the json file

{
   "id": 0,
  "species": "Panthera leo",
   "name": "Lion"
}
1 Like

interesting

maybe because there is no draw() and you don’t do the text in draw()?

1 Like

hi

no it is the same …the problem is the json file

JSONObject json;

int id;
String species;
String name;

void setup() {

  json = loadJSONObject("data.json");

  id = json.getInt("id");
  species = json.getString("species");
  name = json.getString("name");
 
}

void draw(){
  textSize(12);
  text(id, 10, 10); 
  text(species, 10, 20);
  text(name, 10, 30);
}

is the json file included in the export files?

is it in the data folder?

try

void setup() {
    size(600,600); 
    json = loadJSONObject(“data.json”);
    ....
2 Likes

THANKS …
I did not create a datafolder …when i do and put the file there …NO PROBLEM …

THANKS ;o)

Udklip

2 Likes

Quote:

In a program that has the setup() function, the size() function MUST be the first line of code inside setup() , and the setup() function must appear in the code tab with the same name as your sketch folder. https://processing.org/reference/size_.html

1 Like