Virtual device: resource not available

Hello,

I just created a simple application that manipulates an image and everything works fine on the Simulator from MicroEJ SDK, Then I built the project to get the virtual device, However, when I launch it I get the following error:

init/imageGen/internal:
[ImageGenerator] 1 : IMAGE GENERATOR ERROR
[ImageGenerator] [M6] - Invalid image path
[ImageGenerator] (line 5 of C:\[...]\platform\firmware\javaLibs\com.example.test.jar[resources/images/test.images.list])
[ImageGenerator] /resources/images/image1.png
[ImageGenerator] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

However my image is available in the package resources.images

I have tried with a simple resource and getResourceAsStream():

  • with the simulator, getResourceAsStream() returns an input stream.
  • with the virtual device, getResourceAsStream() returns null.

For some reason, my image is not taken into account, Do you have an idea ?

William

Hi,

Can you share a screenshot of your project in MicroEJ SDK (expanded folders) ?

image

OK I see the issue: your resources must be stored in src/main/resources instead of src/main/java.

This works in MicroEJ SDK workspace because Eclipse compiles all source folders into a single classpath directory, which is not the case of MicroEJ Module Manager build.

OK that works
Thank you !