To remove a library reference from the project classpath, follow this procedure:

1.Right-click on the project in the Project Explorer view and select Properties from the drop-down menu.This will open the Propertis dialog.

2.On the Propertis dialog, select the Java Build Path from the list of properties.

3.On the Java Build Path part of the dialog, select the Libraries tab.

4.Find the entry in the list of libraries called Shared Library [], and then select it.

5.Click Remove.

Answer from Mihir on Stack Overflow
Discussions

java - In Eclipse, what is the difference between modulepath and classpath? - Stack Overflow
In Eclipse, what is the difference between modulepath and classpath, and which one should I use to add a JAR file in the lib folder? And why does the JRE System Library appear in modulepath? More on stackoverflow.com
🌐 stackoverflow.com
Module Path Vs Class Path in eclipse | Selenium Forum
Can you pls help me understand ... Path in eclipse ? ... I was trying to launch browser thorugh webdriver, i copied all Selenium jars in module path, but the code was failing with error NoClassDefFound then i cpoied all jars in class path and now i am able to launch the browser. Can you pls help me understand why this happened ? ... All code that is on the classpath lives together in the "unnamed" module. All code on the modulepath lives in their ... More on qtpselenium.com
🌐 qtpselenium.com
eclipse - How do I remove a classpath entry from a classpath container initialized by another plugin? - Stack Overflow
I'd like to modify a classpath container initialised by another plug-in. Specifically, I'd like to filter/remove certain classpath entries in the "Android Dependencies" classpath container initiali... More on stackoverflow.com
🌐 stackoverflow.com
Eclipse: Add dependencies to the module path
Eclipse: Oxygen Buildship: 2.2.0 Gradle: 4.3.1 In Eclipse, when using java8, gradle dependencies are automatically added to the classpath (by Buildship, I believe). When using java 9 Eclipse define... More on github.com
🌐 github.com
6
December 11, 2017
🌐
Reddit
reddit.com › r/javahelp › understanding the module path, class path, and eclipse
r/javahelp on Reddit: Understanding the Module Path, Class Path, and Eclipse
December 26, 2019 -

I've been helping to migrate a large Java 8 project ( 100s of plugins/projects integrated as one SWT application to Java 11 ( version Version: 2019-06 (4.12.0) ).

I've been getting Eclipse error messages along the lines of

The package foo is accessible from more than one module: <unnamed>, foo

Googling around I learned that these situations always existed, but Eclipse hasn't reported them until now. It seem to be the root of the problem is that Java improved. If you make a "Hello World" program into an executable, you don't need to bundle all of the java libraries with it, only the modules you need. So now there is a module path. If you have a library listed in the module path AND the class path you get the kind of errors I did.

That is my superficial understanding, I'm looking for a deeper one.

Does the module path make the classpath obsolete in an application?

Are there tools for Eclipse to tell you were a conflicting library is located ( or a missing library )?

What is the best practice for resolving these conflicts? Removing the redundant entry from the classpath or module path?

The tiny bit of knowledge I got was from Stackoverflow. If there is a doc that explains it in more depth please point me to it. Bonus points if it explains the mechanics of it "like I am 5"


Edit:

I found the redundant jar by using Ctrl Shift T to open the type editor and the searching on that name.


Top answer
1 of 1
47

The module system has mainly the following impact on the code:

  • A package can only be accessed from one module (Nested packages are treated as separate, so even though the package java.util is in the module java.base, the package java.util.logging can be in the module java.logging)
  • You can only access public fields and methods of code in exported packages of other modules. This is true even with reflection (i.e. java.lang.reflect.AccessibleObject.setAccessible(boolean) only works for code in the same module)

All code that is on the classpath lives together in the "unnamed" module. All code on the modulepath lives in their own "named" modules.

You have to distinguish two cases:

  • If you don't add a module-info.java to your project, your project will be part of the unnamed module and can see all other code in the unnamed module, plus code in java.base and code in modules in java.se root module. Basically this means that w.r.t. code on the classpath, everything still works as in Java 8, so you should just put your dependencies on the classpath.

  • If you have a module-info.java in your project, your project will be in its own named module and can only see code in java.base and other named modules which are references using "requires"-clauses in the module-info.java. As named modules are only found via the module path, you should put your dependencies on the module path. This even works for jars created before Java 9, which will get a module name derived from the .jar file name (in which case they are called "automatic" module).

The JRE is always on the module-path, so that its internal code cannot be accessed even from code on the classpath.

There is one special case: If you have a module-info.java in your project and have test code in your project, you usually don't want to mention test dependencies like junit in the module-info.java. There are two solutions for this:

  • Create a dedicated test module. This has always been the convention for osgi-based projects. Disadvantage is that you can only use public API in your tests

  • The solution used by Maven: Put your test dependencies on the classpath. When compiling test code, Maven adds command line options that allow the code in the named module to read the unnamed module (which is not possible via the module-info.java).

In Eclipse Oxygen, the Maven solution was not possible, because it has no notion which code is test code, but this has been implemented in the upcoming Eclipse Photon (4.8) release, which will be out in June. You can already work with the (feature-complete) milestone builds from http://download.eclipse.org/eclipse/downloads/. In case you find any bugs, please report them at https://bugs.eclipse.org/bugs/.

🌐
Eclipse
help.eclipse.org › latest › topic › org.eclipse.jdt.doc.user › reference › ref-properties-build-path.htm
Java Build Path
Any node under the Configured details node can be removed by clicking Remove · Everything that has been configured in this tab can be translated into a set of command line options as specified by the Java Platform Module System (JPMS). To do so click the Show JPMS Options... button. These options could be used for invoking a compiler from the command line, or as runtime options when launching the program, to ensure that the JVM will see the same module graph that has been configured here. Build classpath Classpath variables Inclusion and exclusion patterns
🌐
Oracle
docs.oracle.com › cd › E14545_01 › help › oracle.eclipse.tools.weblogic.doc › html › j2eelib › operations › opRemoveLibRefFromClasspath.html
Removing a library reference from the project classpath
Right-click on the project in the Project Explorer view and select Properties from the drop-down menu.This will open the Propertis dialog. On the Propertis dialog, select the Java Build Path from the list of properties. On the Java Build Path part of the dialog, select the Libraries tab.
🌐
CopyProgramming
copyprogramming.com › howto › module-path-and-classpath-in-eclipse
Module Path and Classpath in Eclipse: Complete 2026 Guide - Module path and classpath in eclipse complete
November 15, 2025 - A: Incrementally add a module-info.java and gradually move dependencies from classpath to modulepath. Start with core dependencies that have module support, use automatic modules for others, and plan a timeline for the full migration. This prevents breaking the entire build at once. Q: Why does Eclipse show "Unbound classpath container" errors?
🌐
qtpselenium
qtpselenium.com › selenium-training › forum › module-path-vs-class-path-in-eclipse-4485
Module Path Vs Class Path in eclipse | Selenium Forum
Can you pls help me understand what is the diferences between Module Path and Class Path in eclipse ? ... I was trying to launch browser thorugh webdriver, i copied all Selenium jars in module path, but the code was failing with error NoClassDefFound then i cpoied all jars in class path and now i am able to launch the browser. Can you pls help me understand why this happened ? ... All code that is on the classpath lives together in the "unnamed" module. All code on the modulepath lives in their own "named" modules.
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 12037008 › how-do-i-remove-a-classpath-entry-from-a-classpath-container-initialized-by-anot
eclipse - How do I remove a classpath entry from a classpath container initialized by another plugin? - Stack Overflow
final IPath path = new Path(AdtConstants.CONTAINER_LIBRARIES); IClasspathContainer container = findClasspathContainer(classpath, path, project); MavenLibrariesClasspathContainer newContainer = new MavenLibrariesClasspathContainer("Android Dependencies", path); for(IClasspathEntry entry : container.getClasspathEntries()) { if(!entry.getPath().toOSString().contains(File.separator + "libs" + File.separator)) { newContainer.addClasspathEntry(entry); } } classpath.removeEntry(path); JavaCore.setClasspathContainer( new Path("me.gladwell.eclipse.m2e.android.LIBRARIES"), new IJavaProject[] { project }, new IClasspathContainer[] { newContainer }, new NullProgressMonitor() );
🌐
GitHub
github.com › eclipse › buildship › issues › 620
Eclipse: Add dependencies to the module path · Issue #620 · eclipse-buildship/buildship
December 11, 2017 - Without this, references to the given automatic modules cannot be resolved by the Eclipse compiler. It is possible, of course, to add the jar files one by one, manually, but that is impractical when a project depends on over 60 jars. Moreover, Buildship will remove them all each time the project is resynch with gradle.
Author   eclipse-buildship
🌐
Eclipse
archive.eclipse.org › eclipse › downloads › documentation › 2.0 › html › plugins › org.eclipse.jdt.doc.user › tasks › tasks-118.htm
Deleting a classpath variable
Expand the Java category in the left pane, and select Classpath Variables. Select the variable(s) you want to delete in the Defined class path variables list and click the Remove button.
🌐
SetGetWeb
setgetweb.com › p › rational › org.eclipse.jdt.doc.user_3.0.1 › tasks › tasks-118.htm
Deleting a classpath variable
Expand the Java category in the left pane, and select Classpath Variables. Select the variable(s) you want to delete in the Defined class path variables list and click the Remove button.
🌐
CodingTechRoom
codingtechroom.com › question › eclipse-modulepath-vs-classpath
Understanding the Difference Between Modulepath and Classpath in Eclipse - CodingTechRoom
Learn about the differences between modulepath and classpath in Eclipse and how to use them effectively to manage JAR files.
🌐
Eclipse
bugs.eclipse.org › bugs › show_bug.cgi
520300 – [9] Nodes for module path and class path on Java Build Path
September 29, 2017 - Download · Getting Started · Members · Projects · Community · Marketplace · Events · Planet Eclipse · Videos · Participate
🌐
Baeldung
baeldung.com › home › java › core java › classpath vs. modulepath in java
Classpath vs. Modulepath in Java | Baeldung
January 16, 2024 - We include the lib/mylibrary.jar file in the classpath using the -cp option and the current directory (.) where the program’s class files reside. It is a collection of directories, JAR files, and modules that contain compiled module files (.mod files) and their associated dependencies. In addition, when a modular Java program is executed, the JVM uses the modulepath to resolve modules and their dependencies.
🌐
Stack Overflow
stackoverflow.com › questions › 77610832 › modulepath-and-classpath-cant-be-found-in-java-build-path-libraries
eclipse - Modulepath and Classpath can't be found in Java Build Path Libraries - Stack Overflow
... Please go to Project > Properties: Java Compiler and hit Apply and Close. If this does not help, show what you have there (Compiler compliance level should be set to 17 in your case).
🌐
Gradle
discuss.gradle.org › help/discuss › buildship
How in Eclipse project module java-9 have modulepath and classpath together? - Buildship - Gradle Forums
October 1, 2019 - Hello, For my first contact with Gradle I created a java module project (OpenJDK-11) under Eclipse. The version of Eclipse is “2019-09 (4.13)” and I used the plugin “Buildship Gradle integration 3.0” to create the project. I ended up figuring out how to set up the build.gradle file to integrate module path or class path dependencies but I do not see how to have both.
🌐
Reddit
reddit.com › r/eclipse › maven update - classpath vs modulepath
r/eclipse on Reddit: Maven Update - Classpath vs Modulepath
July 10, 2023 -

I have a number of Java 11 module-enabled projects using maven for build. Every time I run a maven update it moves the Maven Dependencies object from the Modulepath to the Classpath, creating linkage errors. I then have to manually edit properties of the project and move it back to Modulepath, which then fixes the errors.

The issue is referenced in the Stack Overflow post here. I've tried to place a modulePath entry in the POM file as described in the answer in that article, but eclipse does not recognize that element under the configuration tree.

I tried updating the version of the maven-compiler-plugin to the latest 3.11.0, which does offer a tantalizing useModulePath entry:

<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.11.0</version>
    <configuration>
        <release>11</release>
        <useModulePath>true</useModulePath>
    </configuration>
</plugin>

But that doesn't appear to change the behavior. The article here claims that moving the entry from Classpath to Modulepath has no effect, but that is demonstrably false because it removes the third attribute line in the .classpath file:

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
    <attributes>
        <attribute name="maven.pomderived" value="true"/>
        <attribute name="org.eclipse.jst.component.nondependency" value=""/>
        <attribute name="module" value="true"/>
    </attributes>
</classpathentry>

This approximately matches the change referenced in the first article:

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
    <attributes>
        <attribute name="maven.pomderived" value="true"/>
        <attribute name="module" value="true"/>
    </attributes>
</classpathentry>

It also causes problems in the eclipse workspace about indirectly referenced class files - the following is an example:

The type software.amazon.awssdk.awscore.client.builder.AwsClientBuilder cannot be resolved.  It is indirectly referenced from required .class files.

If it's not that it's something else - that's just the first error I wrote down to demonstrate the error. My current eclipse version is 2022-06 (4.24.0) and current build ID is 20220609-1112.

I've been having to make the manual change after every rebuild for years - I don't remember it ever working after I moved to maven. I've just ignored it until now, but I'm trying to tie up loose ends before bringing in another developer.

I posted this a few days ago in r/javahelp, but this sub might be more appropriate.

🌐
Wordpress
vishwanathk.wordpress.com › 2011 › 05 › 05 › resolving-classpath-issues-with-eclipse-maven
Resolving classpath issues with Eclipse + Maven | Vishwanath Krishnamurthi's blog
October 2, 2013 - If that doesn’t work, or your classpath problem isn’t that obvious, try regenerating the .classpath file. ... Go to the root directory of the project and delete .classpath, .settings and .project (Now its not an eclipse project anymore..