Introducing the JPMS
Before Java SE 9, the only mechanism we had to handle dependencies in Java was the classpath
parameter. The classpath
parameter is where we put dependencies in the form of JAR files. However, the problem is that there is no way to determine which JAR file a particular dependency came from. If you have two classes with the same name, in the same package, and present in two different JAR files, one of the JAR files would be loaded first, causing one JAR file to be shadowed by the other.
Shadowing is the term we use to refer to a situation where two or more JAR files that contain the same dependency are put into the classpath
parameter, but only one of the JAR files is loaded, shadowing the rest. This JAR dependency entanglement issue is also known as JAR hell. A symptom that indicates that things are not so good with dependencies that have been loaded into the classpath
parameter is when we see unexpected ClassNotFoundException
exceptions at system runtime.