J
JavaEnquirer
An application gets launched - application.jar. The application calls a
method on a second jar - utility.jar. This method's job is to load a
resource from application.jar. How do you achieve this? When
utility.jar attempts to access a jar resource, the usual method of
using a class loader doesn't work, as its class loader is for itself,
not application.jar!
How do you get around this? I've tried a few things e.g.
1. adding application.jar to utility.jar's class path ( horrid coupling
),
2. passing a reference to application.jar's class loader to utility.jar
to use to access application.jar's resources.
Neither works!! Any ideas? This is really frustrating and I can't
believe that no one else has this problem. Surely, when developing
desktop applications, it's common practice to farm out resource
management code to an external, reusable jar, and then expect it to
access resources in the main application jar. Aargh! Many thanks in
advance.
method on a second jar - utility.jar. This method's job is to load a
resource from application.jar. How do you achieve this? When
utility.jar attempts to access a jar resource, the usual method of
using a class loader doesn't work, as its class loader is for itself,
not application.jar!
How do you get around this? I've tried a few things e.g.
1. adding application.jar to utility.jar's class path ( horrid coupling
),
2. passing a reference to application.jar's class loader to utility.jar
to use to access application.jar's resources.
Neither works!! Any ideas? This is really frustrating and I can't
believe that no one else has this problem. Surely, when developing
desktop applications, it's common practice to farm out resource
management code to an external, reusable jar, and then expect it to
access resources in the main application jar. Aargh! Many thanks in
advance.