Is the Java classpath final after JVM startup?

后端 未结 7 586
灰色年华
灰色年华 2021-02-02 11:11

I have read a lot about the Java class loading process lately. Often I came across texts that claimed that it is not possible to add classes to the classpath during runtime and

7条回答
  •  无人共我
    2021-02-02 11:33

    I can only comment from what I remember of my own experience of hacking a non-sun JVM ten years ago, but it did scan the entire classpath on startup, as an efficiency measure. The names of all classes found were added to an internal hashtable along with their locations (directory or zip/jar file). However, that was ten years ago and I can't help but wonder whether this would still be a reasonable thing to do in most settings considering how disk and memory architectures have evolved.

提交回复
热议问题