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

2.7k views Asked by At

I want a mechanism that will allow to dynamically load and unload jars as well as calling an activator class in the jar. I don't want to use OSGi because of the cumbersome import/export mechanism.

3

There are 3 answers

0
Nate On BEST ANSWER

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.

0
Yishai On

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.

2
Michael Aaron Safyan On

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.