• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I need help with custom ClassLoader's

 
Frank Hale
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 MyPlugin.java 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,
Frank
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic