[英]Load image from external jar ,classpath at runtime
i have an application depends on plugins i have a case when i want to load an image from one of my plugins jar 我有一个应用程序依赖于插件我有一种情况,当我想从我的一个插件jar中加载图像时
the only way to load the image is 加载图像的唯一方法是
ClassFromPLugin.class.getClassLoader().getResource("image.png");
how can i load the image without using the ClassFromPlugin but use current Component class who need that image 我如何不使用ClassFromPlugin加载图像但使用需要该图像的当前Component类
i am loading my jars at runtime , and this specific component who want to load the image don't know where it came from , he just get the image location 我在运行时加载我的jar,这个想要加载图像的特定组件不知道它来自哪里,他只是获得图像的位置
thank you 谢谢
您必须使用ClassLoader加载包含图像的jar。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.