java: is there a framework that allows dynamically loading and unloading of jars (but not osgi)?

浪尽此生 提交于 2019-12-01 14:10:33

There's a project called the Java Plugin Framework that might be what you're looking for. On their web page it states the project is an attempt to match and extend Eclipse's pre-OSGI plugin architecture. It's a generic framework and isn't tied to SWT/desktop apps.

You can use the ClassLoader to dynamically load classes from JAR files. When you have dynamically loaded the class, you can explicitly invoke an initialization routine if necessary. Like the rest of Java, this mechanism is garbage-collected, so there is no way to explicitly unload the JAR; it is up to the JVM to release the JAR when the dynamically loaded classes are no longer referenced and garbage collection has run.

Yishai

JavaRebel, but it is mostly appropriate for development, not a production deployment. If you are looking for an open source alternative, you can follow this question.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!