Package accessible from more than one module: <unnamed>

混江龙づ霸主 提交于 2021-01-22 05:28:14

问题


When trying to register an MBean in JMX Console I'm getting the following error message:

The package javax.management is accessible from more than one module: <unnamed>, java.management

I'm using Eclipse and I have no module-info.java file in my project structure.

The error disappear when I comment my dependency for Java EE API, but the javax.management package is not part of the JAR.


回答1:


I experienced similar issue when updating from java 8 to java 11. Steps below helped me,

  • Right click Eclipse project > Properties > Java Build Path
  • In Libraries tab, remove all the external jar files under Modulepath and add them under Classpath (you can just select all the jars and drag them under Classpath)
  • Click Apply and Close

Note: JRE System Library will remain under Modulepath.

Eclipse version: 2019-09




回答2:


Are you using Java-1.8? Because it is default package no need to add dependency for that.




回答3:


I was using java11, after switching back to java 8 helped me to resolve these issues in java build path.



来源:https://stackoverflow.com/questions/55902512/package-accessible-from-more-than-one-module-unnamed

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