Search code examples
javasqlitejvmclassloader

Why doesn't the JVM load classes from a database?


Why doesn't the Java virtual machine load classes from a database (similar to the GAC of .NET)? As I understand it, currently it has to read and scan the manifests of each JAR on the class path in order to locate class files. Wouldn't using a database (like SQLite) boost startup time?


Solution

  • Depending on how you define "database" both IBM (shared classes) and Oracle (shared data) already do have technologies to speed up startup and decrease memory footprint.

    Class load time is actually very small (on a class by class basis), so adding something like a database in the way won't realistically change you performance in a good way, especially if you have to blast the bytes over a wire (rather than simply read a local file system jar entry). All the JVMs today are highly optimized down the class loading path and adding SQL will certainly not help for performance. (flexibility of distributed repositories, etc.. is a different question and I see advantages there.)