This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
what i need is to be able to include my data files and pictures with my jar files. But when i include them into the jar, it will load the pics/data files when the jar is in same directory, but not when it is in another location.
i've heard to use classloader, but i do not know how to use it.
ok when i create the jar file, I put the files that are in the folder with it. Now if i try to move that jar file to desktop, when i run it, the images and datafiles wont be included in the jar. the jar will only use the images/data files if its in the same directory that i initially created that jar file in.
Joined: Mar 22, 2005
I see. Well, the getResourceAsStream approach allows you to keep those files in the jar, so the problem can't occur.
Joined: Jan 24, 2006
so the parameter to the function would be the String filename of the file i want to keep in the jar?