Search code examples
javaclassjvmloader

Custom Class Loading issues


The issue i am currently working on requires the changes to a class in a dynamic web project be loaded to the JVM without restarting the application. I already know about J Rebel as I tried using it as well(just don't have enough cash to buy it). So I am actually stuck with creating a custom class loader for this project.

My real problem lies with how to detect the change in class file and load the changes into the JVM. So if there exists a tool or API or if someone knows how to go about doing it or any reference links to help with this issue I would be greatly thankful for the same.

Thanks in Advance


Solution

  • Since Java 7 you can use NIO.7 WatchService See this Oracle tutorial.

    BTW: You shouldn't create your own ClassLoader.