Dynamic class reloading works only in debug mode, why/ how it really works?

情到浓时终转凉″ 提交于 2019-12-06 03:01:39

Here's a simplified version of what happens:

  1. The JVM loads classes and other resources into the classpath exactly once (unless running in debug mode) from the directories or Jars specified in the CLASSPATH environment variable.
  2. To do this, it uses ClassLoaders
  3. Once a resource has been loaded by a ClassLoader instance, it remains in memory until the ClassLoader is garbage collected.

The debug mode is a special mode provided by the JVM, and the classloader works harder to give you the latest version of the resource.

It is not possible to reload the same class with the same class loader

you can find a well written article about dynamic class re/loading here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!