Jar Problems

My executable jar is having problems finding art assets. I create the jar using: jar cmfv mymanifest.mf Words.jar [class files] images. My directory is /ClassFiles/images and I create the jar while in ClassFiles. I’m also using getResource and Class Loader to grab my art assets: URL url = this.getClass().getClassLoader().getResource(ref); I’ve tried searching for an answer but couldn’t find one and apologize if this is asked often.

Here is a simple example:

http://kaioa.com/k/jarimage.jar (source included + double clickable)

I always use pathes with leading slashes, because they are (imo) easier to work with. Eg if the jar contains some directory called “images” and there is some image called “foo.png”… then I can access it with “/images/foo.png” from everywhere (even if its not jar-ed).