Skip to content
Advertisement

Eclipse IDE for Java Developers 2021-06 Cannot find class paths for jars

I have built a new machine and installed a fresh version of eclipse (Eclipse IDE for Java Developers 2021-06). If I run an old project it works. If I make a new project I the following error.
Exception in thread “main” java.lang.NoClassDefFoundError: net/crl/CRLibs/DBI at EnvList.(EnvList.java:143) Caused by: java.lang.ClassNotFoundException: net.crl.CRLibs.DBI
There are no errors in the code. The build path looks like:

New Build Path

Line:143 is: static DBI db = new DBI();

DBI is defined in the crlibs jar. In my old Eclipse (Oxygen) the build path looks like: Oxygen Build Path

I tried adding the crlibs jar to the Classpath, but it will not let me save it (all boxes grayed out). Now this code is copy of a template I use. The original runs just fine and its build path looks like the one from Oxygen.

If I comment out this line it will give the same error at the next library access. It appears that the Class paths to the library are not being included. Note The library was built with Oxygen. Do I need to rebuild it with the new version and if so will it then still work for all the code build with Oxygen. How do I fix this?

Note: Eclipse Java EE IDE for Web Developers. Version: Oxygen.3a Release (4.7.3a) Build id: 20180405-1200

And Eclipse IDE for Java Developers (includes Incubating components) Version: 2021-06 (4.20.0) Build id: 20210612-2011

EDIT: Here is the .classpath file.:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="resources"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-16">
        <attributes>
            <attribute name="module" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="lib" path="E:/Documents and Settings/Cliff/libs/crlibs.jar" sourcepath="E:/Documents and Settings/Cliff/Libs_src/CRLibs/src/net/crl/CRLibs">
        <attributes>
            <attribute name="javadoc_location" value="file:/E:/Documents%20and%20Settings/Cliff/Libs_src/CRLibs/CRLibs/doc/"/>
            <attribute name="module" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="output" path="bin"/>
</classpath>

The path to the jar is there?

EDIT2 enter image description here The command line:

enter image description here

Advertisement

Answer

In the figure below

enter image description here

You must delete the jar from Modulepath THEN add it to the Classpath. The JRE seems just fine in the Modulepath. Once my library is in the classpath the code works.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement