Eclipse Java Editor highlights the error but code compiles

后端 未结 2 1341
难免孤独
难免孤独 2020-12-21 15:56

When using JDK 11, Eclipse 2019-03 and jaxb-api (version 2.4, latest available in maven repository), Java Editor in Eclipse highlights the line:



        
相关标签:
2条回答
  • 2020-12-21 16:10

    Yes, this is a bug of the Eclipse 2019-03 Java IDE (in jaxb-api javax.xml is a subpackage, which is allowed, but not a real package, which would not be allowed):

    Eclipse Bug 546315 - [11] "The package […] is accessible from more than one module: , […]" error shown in Java editor by mistake

    The bug has already been fixed. So either ignore it (since the code is compiled) or use a newer version like Eclipse 2019-06 (4.12).

    0 讨论(0)
  • 2020-12-21 16:25

    This happens when you have added the external jars in the ModulePath.

    Solution:

    1) Remove the external jars from the node "Modulepath". 2) Select the node "Classpath" then add the external jars. 3) Review that all the jars are under the node "Classpath".

    0 讨论(0)
提交回复
热议问题