8

It is said that java 9 modules will solve classpath hell. However, I am thinking about the following situation: Module A uses modules B and C. Both modules will export a class with same name and package. How will the classloading issue be solved here?

ZhekaKozlov
  • 36,558
  • 20
  • 126
  • 155
Roxana
  • 1,569
  • 3
  • 24
  • 41

1 Answers1

11

This situation is forbidden in the Java 9 module system. If two modules in the same layer have the same package, Java 9 will fail at startup with an error:

java.lang.LayerInstantiationException:
    Package <package_name> in both module <moduleB_name> and module <moduleC_name>
ZhekaKozlov
  • 36,558
  • 20
  • 126
  • 155