Link to home
Start Free TrialLog in
Avatar of shji1
shji1

asked on

A different extension folder

Is there a way to define or add a different extension directory (other then <JRE>\lib\ext) in a way that the extension class loader will automatically load the JARs in that directory?
(I am trying to avoid writing a custom class loader)

Thanks!
Avatar of Mick Barry
Mick Barry
Flag of Australia image

-extdirs <directories>

thats for compiling, am not aware of an option for the vm.
YOu should be able to use URLClassLoader instead of writing your own loader.
Would just need to pass it a list of all jar files in the directory.
Avatar of shji1
shji1

ASKER

I know about the URLClassLoader, but I am trying to find a simpler way...
For now, I found a very nice (and working) property that is called java.ext.dirs. I can control the extention directory by passing it to the execution line with a -D option.
But this is not good for what I need. I want it to be modfied at runtime (just like using my own the URLClassLoader).
Now I am trying to change this property at runtime, but I guess that this wont work since the class loading architecture does not probe the extention folders (for my knowledge...) during runtime.
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
SOLUTION
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 shji1

ASKER

You are right about that, and for now I think I'll just stick to the URLClassLoader.

Thanks anyway!
:-)