Java 9 modules and classpath hell: conflicting class names

ぃ、小莉子 提交于 2019-12-10 03:42:01

问题


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?


回答1:


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>


来源:https://stackoverflow.com/questions/44086361/java-9-modules-and-classpath-hell-conflicting-class-names

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