4

My project works fine with Java 1.8u151. I am trying to upgrade it to Java 12 but I am getting the following error.

Package is accessible from more than one module <unnamed>

This is the only error and is repeated with most packages in Java 12 but works fine with Java 8.

I have tried moving all jar files to classpath from module-path. Only Java 12 libraries in module-path. I rried to look for anything deprecated in packages with Java versions. I tried 3 different systems with different Java versions (all running OS-X 10.13.6, 10.13.3 10.11.6 and my own system 10.14.6).

Error Screenshot - https://drive.google.com/open?id=1GS_v4rWe5wtigHIDeYtqd2r9YmTVyXbd

Errors are same with "org.w3c.dom" & "org.xml.sax" - package being called from <unnamed> and java.xml

The best solution would be to remove the problem or a way to guide the compiler to use JRE System Libraries only.

halfer
  • 19,824
  • 17
  • 99
  • 186
Karan Gaur
  • 809
  • 7
  • 20
  • 1
    This question has been marked as a duplicate of the wrong question. It's not an Eclipse bug but a limitation of Java 9 and higher: https://stackoverflow.com/a/53824670/6505250 – howlger Aug 19 '19 at 06:48
  • 3
    It looks like you have a dependency containing the same classes as the system library (which is not allowed in Java 9 and higher). In this case, just remove the dependency to fix the error. – howlger Aug 19 '19 at 07:03
  • 1
    This is the correct answer. Not an eclipse bug but a limitation of java 9 and above. @howlger please correct it if possible. Thanks!! – Karan Gaur Aug 19 '19 at 10:57
  • I'm voted to reopen, so it can be closed again as duplicate of the right question. I have not enough reputation to change it by my own. You might add a note to the question. – howlger Aug 19 '19 at 12:11
  • Does this answer your question? [Eclipse can't find XML related classes after switching build path to JDK 10](https://stackoverflow.com/questions/51094274/eclipse-cant-find-xml-related-classes-after-switching-build-path-to-jdk-10) – Guillaume Feb 11 '21 at 19:44

2 Answers2

-1

Looks like bug in eclipse Bug 546315 - [11] "The package [...] is accessible from more than one module:

Try to use latest version to fix this issue.

Sumit Singh
  • 15,743
  • 6
  • 59
  • 89
  • 3
    That is not about a subpacke like in the Eclipse bug that you referenced in your answer. It is a limitation of Java 9 and higher: two modules must not use the same package name. See https://stackoverflow.com/a/53824670/6505250 – howlger Aug 19 '19 at 06:56
-1

There's a bug in Eclipse which is not fully fixed. You may want to report your way of reproducing bug, if you find exact bug reproduction steps.

Simonas
  • 301
  • 2
  • 12
  • 1
    The referenced bug is fully fixed. In this case here, no subpackage is involved. But in Java 9 and higher two modules must not use the same package. See my comment above. – howlger Aug 19 '19 at 06:52