How can I get my resources to export with my Jar File?

42 Views Asked by At

I am trying to export a Jar file including several images, fonts, etc. All of this works perfectly in intelliJ, works perfectly in Jar file on creating computer, but will not work on other computer.
I used absolute paths for these resources. Using relative paths, I encounter no errors in intelliJ, but images do not appear in Jar File. No errors are reported from command line.

I am a beginner, so I apologize if this is obvious.

 this.originalIcon = new ImageIcon("Resources/leftarm1.png");
 this.image = this.originalIcon.getImage();
 this.scaledImage = this.image.getScaledInstance(Main.tileSize3, Main.tileSize2, Image.SCALE_SMOOTH);

Resource folder is marked as resource root. Resource and source folders are at same level in project directory. Everything works fine with absolute path, works fine with above relative path until exported as Jar file, then image disappears.

0

There are 0 best solutions below