Hi,
I have a sandboxed Applet, but that should not make a difference.
The Applet consists of 2 jars. If I host both files on the same domain1 all is fine. Due to certain special circumstances I need to host jar2 on a different domain2.
In the applet tag I list both files archive="jar1.jar, http://domain2.com/jar2.jar".
First it seems to be working great. Both jars are loaded and everything works fine. Still, as soon as I try to access a resource (like an image) from INSIDE one of the jars there is a problem.
How do I get resources from my jars? I get resources by first getting an URL for the location of the resource:
public static URL getURL(String name) {return ResUtils.class.getResource(path);}
If I host both jars on domain1 this method returns an URL. When hosted on two domains getURL(...) returns NULL which then results in an Exception when fetching the resource:
Caused by: java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(Unknown Source)
I guess ResUtils.class.getResource uses its Classloader to return an URL. For some reason when hosting both jars on two domains add calls to getRessource() return NULL.
So my question is:
- Why does getURL return NULL?
Is the Java plugin designed to disallow hosting those jars on different domains? How do I have to load my resources when I host the jars on different domains?
I am stuck for a week now - thanks for your help,