I have a problem with resources folder in Gradle

(I am using IntelliJ Idea)
Then I build project and run usually all works good. But then I build jar and run it, this appears.

Exception in thread "main" com.jme3.asset.AssetNotFoundException: test.png
	at com.jme3.system.JmeDesktopSystem.showSettingsDialog(JmeDesktopSystem.java:150)
	at com.jme3.system.JmeSystem.showSettingsDialog(JmeSystem.java:155)
	at com.jme3.app.SimpleApplication.start(SimpleApplication.java:120)
	at com.alexwayles.obama.Main.main(Main.java:21)

Show us code and configuration…

package com.alexwayles.test;

import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;

public class Main extends SimpleApplication {

    Geometry geometry;

    public static void main(String[] args) {
        Main app = new Main();
        app.start();
    }

    @Override
    public void simpleInitApp() {
        Box box = new Box(1, 1, 1);
        geometry = new Geometry("Box", box);

        Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        material.setTexture("ColorMap", assetManager.loadTexture("test.png"));
        geometry.setMaterial(material);

        rootNode.attachChild(geometry);
    }

    @Override
    public void simpleUpdate(float tpf) {
        geometry.rotate(0, tpf, 0);
    }
}

Hmm, where is the test.png? And could you show build.gradle?

plugins {
    id 'java'
}

group 'com.alexwayles'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
    implementation "org.jmonkeyengine:jme3-core:3.4.0-stable"
    implementation "org.jmonkeyengine:jme3-desktop:3.4.0-stable"
    implementation "org.jmonkeyengine:jme3-lwjgl:3.4.0-stable"
}

test {
    useJUnitPlatform()
}

Screenshot_56

Yeah, if you don’t find it in the built JAR file… try specifying the resources separately to Gradle, like so:

src/main/resources should be automatic, though. So it’s weird if it’s not being picked up in the jar.

Edit: also weird that the exception is in the JME settings dialog. I feel like maybe we are still missing some information or the test code shown is not the real test code.

Screenshot_57