A
adrian.bartholomew
Hi. I have a server/client game solution that utilises many gifs in
the course of its life.
However, I have 3 gifs that are PRIORITY and should be loaded at the
start and for speed purposes, should be loaded directly from a local
client side folder.
So I placed them in a folder int the client path so that that floder
would be included in the client jar file.
On expanding the jar file, I have confirmed that the gif folder is
indeed in the package.
This is the code I'm using to load a gif from that folder:
URL url = getClass().getResource("../images_priority/" +
pi.index + ".gif");
image = ResourceUtils.getImage(url);
....
public static Image getImage(URL url) {
if (url == null) return null;
Image image = null;
try {
image = GraphicsUtilities.loadCompatibleImage(url);
} catch (IOException ex) {
ex.printStackTrace();
}
if (image != null && image.getWidth(null) > 0) {
System.out.println("Found the image file: " +
url.toString() + " : " +
image.getWidth(null) + "," +
image.getHeight(null));
}
else System.err.println("Couldn't find file: " +
url.toString());
return image;
}
_______________________
When I run the program from my IDE, everything loads fine.
However, it does not when run from a browser/remote server situation.
Any ideas?
the course of its life.
However, I have 3 gifs that are PRIORITY and should be loaded at the
start and for speed purposes, should be loaded directly from a local
client side folder.
So I placed them in a folder int the client path so that that floder
would be included in the client jar file.
On expanding the jar file, I have confirmed that the gif folder is
indeed in the package.
This is the code I'm using to load a gif from that folder:
URL url = getClass().getResource("../images_priority/" +
pi.index + ".gif");
image = ResourceUtils.getImage(url);
....
public static Image getImage(URL url) {
if (url == null) return null;
Image image = null;
try {
image = GraphicsUtilities.loadCompatibleImage(url);
} catch (IOException ex) {
ex.printStackTrace();
}
if (image != null && image.getWidth(null) > 0) {
System.out.println("Found the image file: " +
url.toString() + " : " +
image.getWidth(null) + "," +
image.getHeight(null));
}
else System.err.println("Couldn't find file: " +
url.toString());
return image;
}
_______________________
When I run the program from my IDE, everything loads fine.
However, it does not when run from a browser/remote server situation.
Any ideas?