I'm trying to compile everything in a single JAR file. It includes a manifest file, classes I needed for the program, and also the folder where the pictures and icons are located.
Main.class
SubExt.class
Frame1.class
Data.class
Graphics (folder)
Inside the graphics folder, I have 3 sub folders:
Icon
Text
Bg
Icon folder has all the icon files. Text folder has all the fonts used. Bg folder has all the backgrounds used in the program.
I tried compiling it in one single jar file:
jar cvfm PackagingJava.jar Manifest.mf *.class Graphics
If I would try running it on the same directory (where the graphics folder is also located), it would run properly. But when I try running it on different directory (e.g. Desktop), it would not display fonts, backgrounds, and icons correctly. It will just display a blank white background.
I didn't use an absolute path in my program. When I added Icons on my program, it looked like this:
ImageIcon icoSub = new ImageIcon ("Graphics/Icon/a.png");
Also, my font codes looked like this:
Font baseFont;
Font awesomeFont;
baseFont = Font.createFont (Font.TRUETYPE_FONT, getClass().getResourceAsStream("Graphics/Text/awseomeFont.ttf"));
awesomeFont = baseFont.deriveFont (Font.PLAIN, 16);
It doesn't work. What should I do?