Difficulty of running code when compacting sketch into a ZIP-file

So, I have completed an animation with a custom background picture i.e. a picture of a google search. It runs normal & fine on my laptop but when I compremise it into a ZIP-file to send it to my supervisor, I get constantly the same error repeatedly

First, this is the animation I am doing:

PImage space_is_amazing; //defining the background picture as “spaceisamazing”.

int Main_Star_Diameter = 400; // self-explanatory definition for the origin star’s diameter.

int Moon_Diameter = 20; //The diameter of the moon added orbiting the earthlike planet.

int Patros = 40; //The diameter of the first rocky planet.

int Tetao = 60; //The diameter of the second rocky planet.

int b_h_dr = 5; // the blackhole diameter.

int Ast_dr = 8; // The diameter of the manipulating asteroids.

float XCo_S = 900.5; //displaying the x-position of the origin star.

float YCo_S = 450.5; //displaying the y-position of the origin star.

float YCo_FRS = 200.5; //This specific integer is defined as the starting y-coordinate for the random blue stars.

float ElP_Dr = 70.5; //The diameter of the earthlike planet added into the animation.

float Rs_Dr = 7.5; //The diameter of the random light blue stars added into the project.

float Influentical_planet_dr = 20.5; //The diameter of the own manipulative planet in the last section of this animated project.

void setup()
/The setup of this animation is the formation of the background picture & to confirm readjustment of it’s dimensions to that of the actual display window./
{
size(1920, 1080);
space_is_amazing=loadImage(“backgroundpicture.jpg”);
background(space_is_amazing);
space_is_amazing.resize(1920, 1080);
}

//The following coding in ‘void draw’ represents the other following applied methods.
void draw() {
/*The following methods below demonstrate each individual voids within the space animation. */
Manipulate_random_asteroids();
Manipulate_own_random_planet();
Draw_random_stellar_black_holes();
Draw_massive_gas_giant();
Draw_earth_like_planet_and_moon();
Draw_random_rocky_planets();
Draw_random_stars_in_background();
Draw_origin_star();
}

void Draw_origin_star()
{
fill(255, 204, 0);
ellipse(XCo_S, YCo_S, Main_Star_Diameter, Main_Star_Diameter); // the origin star in the middle of the animation.
strokeWeight(3); //strokeweight of the origin star.
}

void Draw_massive_gas_giant()
/This code creates a massive hydrogen gas-filled giant with extremely low temperatures due to it’s large distance away from the origin star./
{
fill(0, 0, 255);
ellipse(1700, 200, 200, 200);
}

void Draw_earth_like_planet_and_moon()
{
fill(51, 204, 204);
ellipse(500, 400, ElP_Dr, ElP_Dr); //code with color definition for the earthlike planet.
fill(150, 150, 150);
ellipse(420, 420, Moon_Diameter, Moon_Diameter);//code representing the small moon orbiting around the planet.
}

void Draw_random_rocky_planets()
{
fill(192, 192, 192);
ellipse(800, 700, Patros, Patros); //showcases the first rocky planet added to the stellar system.
fill(128, 128, 0);
ellipse(1300, 400, Tetao, Tetao); //showcases the second rocky planet added to the stellar system.
}

void Draw_random_stars_in_background()
/This code acquires a loop to fulfil it’s purpose by adding multiple stars in one consistent y-positioning dimension with a constant distance of += 100/
{
int i = 90;
while ( i <= 490 )

{
fill(204, 255, 255);
ellipse(30, i, Rs_Dr, Rs_Dr);
i += 100;
}
}

void Draw_random_stellar_black_holes()
/This nested loop showcases two stellar blackholes in certain distances apart from eachother in both x & y position; increasing their diameter aids visibility but in terms of theoretical accuracy remained small./
{
for (int y = 1; y < 3; y++)
for (int x = 1; x < 3; x++)
{
fill(0);
ellipse(200x, 200y, b_h_dr, b_h_dr);
}
}

void Manipulate_random_asteroids()
/This allows you to draw random asteroids & orbit them for individual subjectivity; my personal is to orbit around outside the earthlike planet./
{
if (mousePressed && mouseX >= 1200 && mouseX <= 1920 && mouseY <= 500)
{
fill(51, 51, 51);
ellipse(mouseX, mouseY, Ast_dr, Ast_dr);//This statements allows the user to toy around the asteroids’ displacements given the boundary condition is confirmed.
frameRate(40); //This is to slow down the animation framerate of deploying the asteroids.
} else
{
background(space_is_amazing); /*If the initial condition is not fulfilled, then the asteroids will disappear in the animation. */
}
}

void Manipulate_own_random_planet()
/* This animated procedure should simulate roughly the occurence of a planet approaching a stellar object and it’s colour chance representing the temperature influence of the manipulative ellipse. */
{
if (mousePressed && mouseX >= 600 && mouseX <= 800)
{
fill(255, 102, 0);
ellipse(mouseX, mouseY, Influentical_planet_dr, Influentical_planet_dr);
} else if (mousePressed && mouseX <= 600 && mouseX != 100 && mouseX > 300 ) {
fill(255, 153, 0);
ellipse(mouseX, mouseY, Influentical_planet_dr, Influentical_planet_dr);
} else if (mousePressed && mouseX <= 300)
{
fill(204, 255, 204);
ellipse(mouseX, mouseY, Influentical_planet_dr, Influentical_planet_dr);
} else
{
fill(204, 255, 204);
ellipse(60, 80, Influentical_planet_dr, Influentical_planet_dr);
}
}

And the error I always get, is this:

The file “backgroundpicture.jpg” is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
NullPointerException
Could not run the sketch (Target VM failed to initialize).
For more information, read Help ? Troubleshooting.

I hope, someone could help me out with this since I have to submit this in a week :grimacing:

Sincerely,
William.

Running from a zip file if you have assets or multiple pde files isn’t recommended. A zip file is to most programs just that a zip File. Meaning there is no folder structure meaning any symbolic link to assets will be inaccessible

Hi @William,

Welcome to the forum! :wink:

If you compress your project, make sure you also compress both the .pde files and the data folder where all your images should be.

If you unzip your archive, you should have your folder with your code and assets inside.

The error you had comes from the fact Processing can’t load your image from the data folder.

Cheers man,
I am so sorry for the late reply but I have figured it out on my own. HOWEVER, your approach was exactly identical to mine.

Much appreciated!