Package accessible from more than one module: <unnamed>

Evandro Pomatti :

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.

enter image description here

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

enter image description here

enter image description here

Pro :

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=104880&siteId=1