What kind of java application are you developing? Web or desktop application.
If it is web application, then you can change your webserver setting to load classes dynamically.
Main Topics
Browse All TopicsHi everybody,
I've searched the internet for some usable information of how to implement a custom classloader that is able to dynamically reload changed Java classfiles located in jar files. Though there's a lot of information about this topic I didn't find any information of real value. At best this would be a piece of Java source code that I could use in my application to enable it to dynamically reload Java classes. So I'll be very glad if anybody knows how to do it and can provide some usable source code. I've had a look at the Tomcat source code but it appears to me that it'll be hard work to find out how Tomcat is doing what I would like to do, too.
Many thanx in advance,
Miknosoft
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi,
thanks for your reply.
Now the problem I'm facing is not how to dynamically load a class. What I have is a server application that is able to execute user provided extensions - you may also say some kind of plugins. Because of the fact, that it's not very nice to force the server application to be shut down and restarted only because of the fact, that one of these user provided plugins has changed, I need a way to reload classes from a jar file that have already been loaded previoulsy. This is a nontrivial task as can be learned from searching the internet regarding this issue. To say it condensed, the problem is how to reload a Java class dynamically that has already been loaded and executed previously, without restarting the controlling application.
Application servers or the Tomcat servlet engine are capable of doing this. But I want my application to be as independent as possible of any existing software environment.
Thanx,
Michael
Look at this link maybe this contains the answer to your question:
http://forum.java.sun.com/
Here is another one :
http://forum.java.sun.com/
Hi,
thank you for your repies, Javatm. Unfortunately the Java forum threads aren't very supportive and didn't help me to solve my problem. Nonetheless I've found a high quality article at http://java.sun.com/develo
Thanks anyway and good luck,
Michael
Business Accounts
Answer for Membership
by: JavatmPosted on 2006-08-30 at 13:31:09ID: 17423846
What do you mean?
.4.2/docs/ api/java/u til/jar/ Ja rFile.html .4.2/docs/ api/java/u til/zip/ Zi pFile.html
ava-se-tip s/java.uti l.zip/
/dynamicla ssloading. html
Loading is different from replacing, if you want to replace a class in a jar you can do so by altering the contents of the jar and re-create a jar.
http://java.sun.com/j2se/1
http://java.sun.com/j2se/1
Here is a real life example but it's using a zip not a jar it doesn't matter
cause they are both compress files ;)
http://www.java-tips.org/j
If we are talking just be dynamically loading a class here is another example;
http://mindprod.com/jgloss