Java 如何在我的eclipse(juno)项目中包含依赖类?

Java 如何在我的eclipse(juno)项目中包含依赖类?,java,eclipse,servlets,Java,Eclipse,Servlets,我将所有jar文件都保存在webcontent/Web-INF/lib中,并内置到Java资源/库中。我的项目在过去两周一直工作正常,但是今天突然所有依赖项都抛出了ClassNotFoundException。请帮忙 我还尝试将所有jar保存在另一个文件夹中,并使用javabuildpath>libraries添加它们 奇怪的是,所有的罐子都添加到了库中,直到昨天一切都很好 编辑:我在WEB-INF/lib(简单复制粘贴)中创建了两个JAR副本,并再次使用构建路径添加它们(新副本)(因此,现在每

我将所有jar文件都保存在
webcontent/Web-INF/lib
中,并内置到
Java资源/库中。我的项目在过去两周一直工作正常,但是今天突然所有依赖项都抛出了
ClassNotFoundException
。请帮忙

我还尝试将所有jar保存在另一个文件夹中,并使用javabuildpath>libraries添加它们

奇怪的是,所有的罐子都添加到了库中,直到昨天一切都很好

编辑:我在WEB-INF/lib(简单复制粘贴)中创建了两个JAR副本,并再次使用构建路径添加它们(新副本)(因此,现在每个JAR都有两个实例)。这解决了问题。 对为什么会发生这种情况有什么看法

编辑2:我的类路径文件:(jar文件的多个副本和“dependency”文件夹是在我尝试不同的方法来解决问题时创建的)


一般来说,为了维护您的项目,如果您使用其他软件来管理您的依赖关系,那么维护项目会简单得多

如果您在引用方面遇到问题,您应该使用MAVEN(MVN)。然后eclipse将解析所有依赖的JAR并正确配置eclipse


如果您想继续使用Eclipse,请将项目中的.classpath文件粘贴到这里

一般来说,如果您使用其他软件来管理依赖关系,那么维护您的项目会简单得多

如果您在引用方面遇到问题,您应该使用MAVEN(MVN)。然后eclipse将解析所有依赖的JAR并正确配置eclipse


如果您想继续使用Eclipse,请将项目中的.classpath文件粘贴到这里

看起来不错,您是否尝试删除所有LIB,然后再添加一次?复制以前的LIB并再次添加它们对我很有用,因此替换以前的LIB也可以!但是你有没有想过为什么会突然发生这种事?这是否意味着eclipse(不使用MAVEN)不稳定?eclipse在依赖项方面总是存在一些问题:(看起来不错,您是否尝试删除所有LIB,然后再添加一次?复制以前的LIB并再次添加它们对我来说很有效,因此替换以前的LIB也会很好!但是有没有想过为什么会突然发生这种情况?这是否意味着eclipse(不使用MAVEN)不稳定?Eclipse在依赖项方面总是存在一些问题:(
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_45">
        <attributes>
            <attribute name="owner.project.facets" value="java"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
        <attributes>
            <attribute name="owner.project.facets" value="jst.web"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>

    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jstl-1.2.jar"/>

    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-codec-1.9.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/poi-ooxml-3.13-20150929.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/poi-ooxml-schemas-3.13-20150929.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/xmlbeans-2.6.0.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-logging-1.1.3.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/junit-4.12.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/log4j-1.2.17.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/poi-excelant-3.13-20150929.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/poi-scratchpad-3.13-20150929.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-fileupload-1.3.1.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-io-2.4.jar"/>
    <classpathentry kind="lib" path="WebContent/dependecies/commons-codec-1.9.jar"/>
    <classpathentry kind="lib" path="WebContent/dependecies/commons-fileupload-1.3.1.jar"/>
    <classpathentry kind="lib" path="WebContent/dependecies/commons-io-2.4.jar"/>
    <classpathentry kind="lib" path="WebContent/dependecies/commons-logging-1.1.3.jar"/>
    <classpathentry kind="lib" path="WebContent/dependecies/jstl-1.2.jar"/>
    <classpathentry kind="lib" path="WebContent/dependecies/junit-4.12.jar"/>
    <classpathentry kind="lib" path="WebContent/dependecies/log4j-1.2.17.jar"/>
    <classpathentry kind="lib" path="WebContent/dependecies/poi-excelant-3.13-20150929.jar"/>
    <classpathentry kind="lib" path="WebContent/dependecies/poi-ooxml-3.13-20150929.jar"/>
    <classpathentry kind="lib" path="WebContent/dependecies/poi-ooxml-schemas-3.13-20150929.jar"/>
    <classpathentry kind="lib" path="WebContent/dependecies/poi-scratchpad-3.13-20150929.jar"/>
    <classpathentry kind="lib" path="WebContent/dependecies/xmlbeans-2.6.0.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/mysql-connector-java.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/mysql-connector-java-5.1.13-bin.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/Copy of jstl-1.2.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/poi-3.13-20150929.jar"/>
    <classpathentry kind="lib" path="WebContent/WEB-INF/lib/Copy of poi-3.13-20150929.jar"/>
    <classpathentry kind="output" path="build/classes"/>
</classpath>