Processing can find the data folder in Windows 11 but not in Linux or Mac

ffernandaffranco
Sun, 02 Nov 2025 20:48:54 +0000
Coding Questions

Hello! I am working on a project for a class in Processing and Java.

It is a game, and for this game I need to load multiple images, a video, and a font. It works correctly in Windows 11. The problem arises when I try to move this project to another computer with a different operating system.

The folder structure is as recommended: Main.pde is located at the same level as the data folder within Main.

I will try to describe the behavior of each one:

Computer with Windows 10: I download the project, run it, and it works correctly.

Computer with Linux Mint (latest version) and Processing downloaded from flatpak: It does not point correctly to the data folder.

Computer with MacOS (I don’t know the version, it belongs to my classmate): It does not point correctly to the data folder.

From Linux, I tried to create a project from scratch and save it in my preferred folder. Then I created a data folder inside that folder, at the same level as Main, and transferred all the necessary files there, but it doesn’t work either.

I also checked to see if, for example, there was an image like “image.png.png,” but that’s not the case.

I’ll leave the code where I load the images below. It’s in Spanish, so I apologize:

Main.pde loads the images, videos, and fonts. Then the other classes query Main for these files.

public class Main extends PApplet {

    // --- ASSETS ---
    public static PFont fuenteMenu;
    public static Movie videoFondoJugando;

    public static PImage fondoMenu;
    public static PImage fondoGameOver;
    public static PImage spriteLeila;
    public static PImage spriteFantasma;
    public static PImage proyectilLeila;
    public static PImage proyectilFantasma;
    public static PImage botonRetorno;
    public static PImage barraVida4;
    public static PImage barraVida3;
    public static PImage barraVida2;
    public static PImage barraVida1;
    public static PImage barraVida0;

private void cargarAssets(PApplet sketch) {
        System.out.println("=== ASSET LOADING ===");
        File sketchPath = new File(sketch.sketchPath(""));
        System.out.println("Sketch route: " + sketchPath.getAbsolutePath());
        File dataPath = sketch.dataFile("");
        System.out.println("Searching data in: " + dataPath.getAbsolutePath());
        System.out.println();

        try {
            // Cargar imagenes
            fondoMenu = validarImagen(sketch.loadImage("fondoMenu.png"), "fondoMenu.png");
            fondoGameOver = validarImagen(sketch.loadImage("fondoGameOver.png"), "fondoGameOver.png");
            spriteLeila = validarImagen(sketch.loadImage("spriteLeila.png"), "spriteLeila.png");
            spriteFantasma = validarImagen(sketch.loadImage("spriteFantasma.png"), "spriteFantasma.png");
            proyectilLeila = validarImagen(sketch.loadImage("proyectilLeila.png"), "proyectilLeila.png");
            proyectilFantasma = validarImagen(sketch.loadImage("proyectilFantasma.png"), "proyectilFantasma.png");
            botonRetorno = validarImagen(sketch.loadImage("botonRetorno.png"), "botonRetorno.png");
            barraVida4 = validarImagen(sketch.loadImage("barraVida4.png"), "barraVida4.png");
            barraVida3 = validarImagen(sketch.loadImage("barraVida3.png"), "barraVida3.png");
            barraVida2 = validarImagen(sketch.loadImage("barraVida2.png"), "barraVida2.png");
            barraVida1 = validarImagen(sketch.loadImage("barraVida1.png"), "barraVida1.png");
            barraVida0 = validarImagen(sketch.loadImage("barraVida0.png"), "barraVida0.png");

            // Cargar fuente
            fuenteMenu = sketch.createFont("upheavtt.ttf", 30);
            if (fuenteMenu == null) {
                throw new RuntimeException("ERROR: Fuente 'upheavtt.ttf' no encontrada");
            } else {
                System.out.println("OK: Fuente 'upheavtt.ttf' cargada");
            }

            // Cargar video
            videoFondoJugando = new Movie(sketch, "fondo_jugando.mp4");
            if (videoFondoJugando == null) {
                throw new RuntimeException("ERROR: Video 'fondo_jugando.mp4' no encontrado");
            } else {
                videoFondoJugando.loop();
                System.out.println("OK: Video 'fondo_jugando.mp4' cargado y en loop");
            }

            System.out.println("\nAssets cargados correctamente.\n");

        } catch (Exception e) {
            System.err.println("Error crítico cargando assets:");
            e.printStackTrace();
            sketch.exit();
        }
    }

AssetLoader is a previous class that I used for this task, but I have commented it out thinking that it might be the problem.

The other classes do not load any files, they only query Main using the declared images (for example calling Main.fondoMenu).

I really don’t know what I’m doing wrong. If anyone here has MacOS or Linux and would be kind enough to run my project and let me know if it works for them, that would be amazing. The Video library needs to be installed for it to load one of the files in data.

Google Drive

Main - Google Drive

This is my Project (file size when uncompressed: 203 mb) . Thank you.

32 posts - 5 participants