Java 9 modules and path addon: conflicting class names

They say that java 9 modules will solve the hellish class. However, I think about the following situation: Module A uses modules B and C. Both modules will export the class with the same name and package. How to solve the download problem?

+6
source share
2 answers

This situation is prohibited in the Java 9 modular system. If two modules of the same level have the same package, Java 9 will fail with an error:

java.lang.LayerInstantiationException:
    Package <package_name> in both module <moduleB_name> and module <moduleC_name>
+10
source

The exception below was when I downloaded my application that uses the jfreechart module ... (which I compiled into the module)

java.lang.LayerInstantiationException: (): jdk/internal/loader/ClassLoaders $ AppClassLoader : java.org.jfree.base

- , ?

,

jcommon.jar (module)
jfreechart.jar (module uses jcommon.jar)
myapp.jar uses jfreechart.jar

myapp.jar, ..

"java.org.jfree.base" but
"org.jfree.base" is there..
0

Source: https://habr.com/ru/post/1677605/


All Articles