I need to include some image files in the exported jar file, I searched a bit and found this and this answers but I can't get it to work.
so my file structure is:
root
-assets
--clean.png
-src
...
I added the assets folder to the build path as suggested but if I unzip the jar the files are not in the assets folder but in the root.
I tried the following codes:
InputStream i = getClass().getResourceAsStream("assets/clean.png");
InputStream i = getClass().getResourceAsStream("/assets/clean.png");
InputStream i = getClass().getResourceAsStream("clean.png");
InputStream i = getClass().getResourceAsStream("/clean.png");
but they none of them work, i
is null
. What I'm missing?
I'm using Maven