File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes I need help with custom ClassLoader's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "I need help with custom ClassLoader Watch "I need help with custom ClassLoader New topic

I need help with custom ClassLoader's

Frank Hale
Ranch Hand

Joined: Mar 25, 2000
Posts: 230
Okay here is my problem. Imagine a program that is similar to a web browser. Instead of this program loading webpages it loads class files and shows them. Now imagine this class file changing while its still loaded into the browser, so it needs to be reloaded. But the problem is that the class which is already loaded gets instantiated again and the new class never gets loaded. Here is some very basic code to describe my problem.
If you wanna help me out, run this program and then press the load class button. Now open the source code of the and change the System.out.println() line to display something else and recompile that file. Now go back to the program that should still be running and hit load class again. What happens is that the new class isn't loaded, you get the cached memory copy of the old one. Can somebody help me figure out how to load the new class in from disk please. Thank you!

Thanks In Advance,
I agree. Here's the link:
subject: I need help with custom ClassLoader's
jQuery in Action, 3rd edition