Search code examples
javajarjvmclassloader

What happens if a Jar is updated while it is still being used by a JVM?


I know that, under typical conditions, a class is only loaded once. I also know that classes are immutable. Thus, once the class is loaded, it cannot be changed unless it is reloaded (which typically doesn't happen).

Does the same thing hold true for Jars? What happens if a Jar is updated while a JVM is still running that had previously loaded classes from the Jar?


Solution

  • Nothing, if a class in that jar is used, the same definition remains, if a new class is loaded in the updated jar it will be taken.