Exported application shows grey screen

Hi all! I’ve been having problems with exporting the code into an application. When I run the application the only thing that shows up is a blank grey screen. This has happened with all the few programs I’ve tried to export. (They all run perfectly on Processing). Here’s the code of the latest one I tried exporting:

Thanks!

> boolean game = false;
> boolean ganar = false;
> int xpos, ypos;
> 
> PImage catintro;
> PImage fondo;
> PImage title;
> PImage taco;
> PImage jugar;
> PImage instruccion;
> PImage kitty;
> PImage tacoman;
> PImage gano;
> PImage jugar2;
> 
> Gato []cat;
> int numgato = 200;
> int cualgato;
> 
> Taco man;
> 
> void setup () {
>   size (1000, 700);
>   //frameRate (120);
>   imageMode (CENTER);
>   //smooth();
>   //background (255);
> 
> 
>   catintro = loadImage ("tacocat.png");
>   fondo = loadImage ("background.png");
>   title = loadImage ("title.png");
>   taco = loadImage ("taco intro.png");
>   jugar = loadImage ("jugar.png");
>   instruccion = loadImage ("instruccion.png");
>   kitty = loadImage ("cat juego.png");
>   tacoman = loadImage ("taco juego.png");
> 
>   gano = loadImage ("gano.png");
>   jugar2 = loadImage ("jugar2.png");
> 
> 
>   cat = new Gato [numgato];
>   for (int c = 0; c<numgato; c++) {
>     cat[c] = new Gato (random(width), random(height));
>   }
> 
>   man = new Taco (random(width), random(height));
> }
> 
> void draw () {
>   println (ganar);
>   println (game);
> 
> 
>   background (fondo);
>   //smooth ();
> 
>   if  (game == false) {
>     ganar = false;
>     image (title, 500, 350);
>     image (catintro, 470, 340);
>     image (taco, 540, 340);
>     image (instruccion, 500, 380);
>     image (jugar, 500, 580);
>     //reiniciar();
>   } else {
>     if (ganar == false) {
>       iniciar();
>     }
>     if (ganar == true) {
>       man.encontrado();
>     }
>   }
> 
> 
>   for (int c=0; c<numgato; c++) {
>     if (mousePressed == true) {
>       if ( (mouseX < (cat[c].xpos + kitty.width/2)) && (mouseX > (cat[c].xpos - kitty.width/2)) && (mouseY < cat[c].ypos + kitty.height/2) && (mouseY > (cat[c].ypos-kitty.height/2))) {
>         cat[c].drag();
>       }
>     }
>   }
> }
> 
> void mouseReleased () {  //intro title before playing, click boton to play
>   if (game == false) {
>     if ((mouseX > 400) && (mouseX < 600) && (mouseY > 540) && (mouseY < 620)) {
>       game = true;
>     }
>   }
>   if (game == true) {
>     if ( (mouseX < (man.xpos + tacoman.width/2)) && (mouseX > (man.xpos - tacoman.width/2)) && (mouseY < (man.ypos + tacoman.height/2)) && (mouseY > (man.ypos-tacoman.height/2))) {
>       man.encontrado();
>       ganar = true;
>     }
>   }
> 
>   if ((ganar == true) && (game == true)) {
>     if ((mouseX > 400) && (mouseX < 600) && (mouseY < 590) && (mouseY > 510)) {
>       reiniciar();
>     }
>   }
> }
> 
> 
> 
> void iniciar () {
>   // boolean game = true;
> 
>   image (fondo, 500, 350);
>   man.move();
>   man.dibujar();
> 
>   xpos = xpos + 5;
> 
>   for (int c = 0; c < numgato; c++) {
>     cat[c].move();
>     cat[c].dibujar();
>   }
> }
> 
> 
> void reiniciar() {
>   game = true;
>   ganar = false;
> 
>   for (int c = 0; c < numgato; c++) {
>     cat[c].move();
>     cat[c].dibujar();
>     cat[c].xpos = random (width);
>     cat[c].ypos = random (height);
>   }
> 
>   man.move();
>   man.dibujar();
>   man.xpos = random (width);
>   man.ypos = random (height);
>   xpos = xpos + 5;
> }
> 
> 
> class Gato {                                                  //class gato
>   float xpos, ypos;
>   float xspeed;
>   float xdirection = 1;
> 
>   Gato (float px, float py) {
>     xpos = px;
>     ypos = py;
>   }
> 
>   void move() {
>     xspeed = random (2, 7);
>     xpos = xpos + (xspeed * xdirection);
> 
>     if (xpos > 1100) {
>       xpos = -100;
>       xspeed = xspeed + random (-3, 5);
>     }
>   }
> 
>   void dibujar() {
>     image (kitty, xpos, ypos);
>   }
> 
>   void drag () {
>     xpos = mouseX;
>     ypos = mouseY;
>   }
> }
> 
> class Taco {                                                      // class taco
>   float xpos, ypos;
>   PImage tacoman = loadImage ("taco juego.png");
> 
>   Taco (float px, float py) {
>     xpos = px;
>     ypos = py;
>   }
> 
>   void move () {
>     xpos = xpos + (random(5, 10)) ;
>     if (xpos > 1100) {
>       xpos = -80;
>     }
>   }
> 
>   void dibujar () {
>     image (tacoman, xpos, ypos);
>   }

  void encontrado () {
    ganar = true;

    image (gano, 500, 350);
    image (jugar2, 500, 550);
  }
}

I am no expert, but this is standard procedure so it should help.

Did you make sure all the files inside of the sketch are intact? Also, did you use the correct settings while exporting? Did you accidentally open an export file that is not the one meant to be open?

Try these things. There is a chance it could work.

Yeah, all the files are fine. What do you mean by correct settings? I have a mac and I only exported once for Mac. That didn´t work…

I haven’t exported many times before so I forgot there are no settings. Try updating your Java. It said that there may be some issues if your java is old

I updated Java. Still doesn´t work…

I don’t know then. Guess I can’t help

Hi @jrubesch,

Welcome to the forum!

If your sketch run’s on the PDE it should run on the application as well (Assuming you are on OS machine).

I noticed that you import images to your sketch, can you check that the data folder that contains the images in the application folder has all images? Some of them might be missing or might not be exported into the standalone applications folders. If this is the case you can manually moved the images into the application folder

I found the mistake! It was because I had the images/files in the folder of the code, not a data folder. The code runs fine on Processing like that, but I guess to export everything needs to be in the data folder. I moved everything to Data and it exported perfectly - for all the programs I’ve had problems with too!

1 Like