You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand that in order to load a resource from inside a plugin jar file, you need to use the Plugin Class Loader. I have two questions about that.
Is it safe to pass the plugin class loader to the plugin itself via the PluginContext I created? My initial gut feeling is no, since you can access the parent/bootstrap classloader from the plugin class loader via getParent().
If I am correct, and passing the plugin class loader to the plugin itself is not safe, how would I safely load a resource from the plugin jar file from inside the plugin code itself?
The text was updated successfully, but these errors were encountered:
So, each available plugin is loaded using a different PluginClassLoader. Inside plugin, any getClass().getClassLoader() call will return the PluginClassLoader related to that plugin.
That being said, I don't see why you would pass the (Plugin)ClassLoader in PluginContext for the simple fact that it is redundant information.
The way to load a resource in a plugin remains the standard one from Java, getClass().getResource("/test.txt") or getClass().getClassLoader().getResourceAsStream("test.txt").
Yes, in some situations you can use getClass().getClassLoader().getParent() to access the parent class loader.
Try to play a little bit with a POC and share with us your project (GitHub) if you have questions or you encounter problems.
I hope what I said is clear, if not, please refine your questions.
I understand that in order to load a resource from inside a plugin jar file, you need to use the Plugin Class Loader. I have two questions about that.
The text was updated successfully, but these errors were encountered: