Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Insubstantial doesn't load via custom classloader #99
My application uses a separate URLClassLoader to handle dynamically identifying and installing extra LookAndFeels. The actual install of the new LookAndFeel would take effect on application restart. When trying to use Insubstantial 7.1 or 7.2, I get the following stack trace:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: No interpolator found for java.lang.Float:java.lang.Float
If I put all substance/trident jars on the main application classpath, everything works fine (probably just the one with interpolators is all that matters).
This prevents folks like me from having applications that dynamically load LookAndFeels from using Insubstantial. We have to have hard dependencies in place.
IIRC, I had to fix at least one ClassLoader issue with the "original" Substance builds myself to get something like this working, but that little experience was long-since thrown away. :(
It looks to me trident is using the thread context class loader to load some of the interpolators it uses (https://github.com/Insubstantial/insubstantial/blob/master/trident/src/main/java/org/pushingpixels/trident/TridentConfig.java#L82). If I were to add a system property that said "Use the getClass().getClassLaoder()" instead would that work? Or does each jar get it's own classloader?
Not sure if this is going to be 100% on point, but this is the code I use in the SwingX LookAndFeelAddons class for obtaining the correct ClassLoader: