...

View Full Version : JAR file, saving images



littlemiss
02-06-2008, 07:04 PM
I have coded a program but i need t to run on a jar file, i have been using the following code to construct it
jar cmf MyManifest Jarfile.jar *

It creates the jar file but does not put the images into the jar file and so when I run the program none of the images show up, how do i get this to work without having to issue all the images with the jar?


Thanks

shyam
02-06-2008, 09:41 PM
It creates the jar file but does not put the images into the jar file and so when I run the program none of the images show up, how do i get this to work without having to issue all the images with the jar?

how else do you intend to package the images?

littlemiss
02-08-2008, 12:29 PM
I got to work in a non static context, so for everyone else having the same problem here is what i did:


URL url1 = this.getClass().getResource("image);
private ImageIcon Image = new ImageIcon(url1);


But i dont know how to get it to work in a static context.

shyam
02-08-2008, 03:22 PM
use the thread context classloader

URL url1 = Thread.currentThread().getContextClassLoader().getResource("image");



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum