Link to home
Start Free TrialLog in
Avatar of robertgw31
robertgw31

asked on

Accessing Resources Embedded in a Dynamically Loaded JAR

I am dynamically loading a JAR and succesfully accessing one of its classes. I am doing this with JarClassLoader. FYI, I was also able to successfully do this with URLClassLoader.

My problem is that the JAR class that I am instantiating is unable to access an XML file cotained in one of the JAR's packages/directories --- a java.io.FileNotFound exception results. Things work fine when I load the JAR on the classpath, but I must do the dynamic load given the architecture within which this has to work.

....any suggestions....anyone?
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of robertgw
robertgw

I assumed that the system classloader was by default the parent of the classloader I was creatging, but I will try this.  This is interesting that establishing the system classloader as the parent of the classloader within which theJAR is being loaded is necessary for a class within that JAR to access a resource that is also within that JAR.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.