I have made a swing application which uses image files located in a folder named ‘res’ in current directory. For that I do something like this :
BufferedImage img=ImageIO.read(new File(new String(System.getProperty("user.dir")+"\\res\\back.png")));
It works perfectly fine when I run it from command prompt. But when I make a jar file out of this, it doesn’t finds the res folder,although the res folder is inside the jar. However when I copy the res folder in the same directory as the jar, it works again. I want a single jar file without any dependency on external folder.
Load from the classpath maybe: