IttayD
IttayD

Reputation: 29123

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

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.

Upvotes: 0

Views: 2816

Answers (3)

Nate
Nate

Reputation: 16898

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.

Upvotes: 3

Michael Aaron Safyan
Michael Aaron Safyan

Reputation: 95509

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.

Upvotes: 1

Yishai
Yishai

Reputation: 91881

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.

Upvotes: 0

Related Questions