Include images into exe?

Answered

Hello everyone,

I'm currently having a problem with using images in my code, which I build as .exe via artifacts. When I use them in the editor, they load just fine, but when I start the exe, my application crashes, because it cannot find the image. Below is the structure of the project (whereas MusicManager is the application class) and teh part, where I load the image.

Is there a way to manually add an image directory to the build, and if yes, how do I reference an image correctly?

Thanks in advance,

Luca

0
2 comments

Please Google for "Java load resource from classpath", something like https://javarevisited.blogspot.com/2014/07/how-to-load-resources-from-classpath-in-java-example.html should work.

In IntelliJ IDEA resource roots are included in the jar, you can also configure the artifact to include any directory: https://www.jetbrains.com/help/idea/artifacts.html.

1
Avatar
Permanently deleted user

Thanks, I'm going to have a look into it again !

I probably messed something up when I tried to use it

0

Please sign in to leave a comment.