Dynamic Class Reloading

Peter B. Kessler Peter.Kessler at Sun.COM
Sat Jul 4 05:47:31 UTC 2009

Andrew Wiley wrote:
> I'm fairly new to OpenJDK, and I'm wondering if there's any way to reload a
> class while an application is in operation. There's JavaRebel and Apache JCI
> to do this with the Sun JDK, but I don't know if there's an equivalent for
> OpenJDK.
> I have a server application that I want to be able to update without
> rebooting it. I would like to at least be able to reload classes when the
> signature doesn't change. These would be classes on the classpath that are
> used normally (directly, not through reflection) in the application. Is this
> possible?

If you can describe the part you want to reload as an interface, you can change the implementation behind the interface at any time by having your own classloader.  Nothing JDK-specific is required, nor is anything needed beyond what's already in the JVM.

			... peter

More information about the discuss mailing list