I'm trying to put images directly into my packaged JAR executable. Currently the only way to display images is having a directory with all the images in the same directory of the JAR.
Is there a way to package images directly into a JAR?
I'm trying to put images directly into my packaged JAR executable. Currently the only way to display images is having a directory with all the images in the same directory of the JAR.
Is there a way to package images directly into a JAR?
you can put them in the resources dir. the issue then is that they don't exist on disk and you have to load them from the jar. I created a Util class to load images and do some other things.
Image image = ImageIO.read(UTILCLASS.class.getClassLoader().getResourceAsStream(path));
where path is just the name of the file or you can give a parent dir if there are files with the same name.