My project has multiple images and one pdf file. Project's JAR needs to be used on various PCs having Linux or Windows in our different offices across multiple cities. That's why I want all the resources to be part of the same single JAR file for easy and error-free portability.
I'm already successfully accessing my images/icons as resources using:
public static final ImageIcon CopyIcon = new ImageIcon(Global.class.getResource("/cct/resources/copy.png"));
But when i access the User Manual (pdf) file using similar code:
File userManual = new File(Global.class.getResource("/cct/resources/manual.pdf").toURI());
Desktop.getDesktop().open(userManual);
...the user manual opens fine when run from within eclipse but no response when accessed from jar file created using
Export => Runnable JAR file => 'Extract/Package required libraries into generated JAR'
option. All other options work seamlessly.
I've tried many solutions found here on SO, but none works because most of them are for other file types e.g. txt or excel or images.