使用Java Ant构建jar文件时出现问题:NoClassDefFoundError

使用Java Ant构建jar文件时出现问题:NoClassDefFoundError,java,ant,build,Java,Ant,Build,当我试图在JavaEclipse中用Ant构建Jar文件时,我遇到了一些问题。我正在寻找其他类似的主题,但我无法找到解决问题的方法,所以我决定直接发布 提前谢谢 这是我的build.xml <project name="MarcarPDF_desarrollo" default="server" basedir="."> <!-- Fichero con las propiedades del servicio --> <property file

当我试图在JavaEclipse中用Ant构建Jar文件时,我遇到了一些问题。我正在寻找其他类似的主题,但我无法找到解决问题的方法,所以我决定直接发布

提前谢谢

这是我的build.xml

<project name="MarcarPDF_desarrollo" default="server" basedir=".">

    <!-- Fichero con las propiedades del servicio -->
    <property file="build_desarrollo.properties"/>
    <!-- Path de compilacion -->
    <target name="clean">
          <delete dir="dist"/>
          <delete dir="distEAR"/>
     </target>

     <path id="path"> 
        <fileset dir="${wl.homelocal}/wlserver_10.3/server/lib">
            <include name="weblogic.jar" />
            <include name="webservices.jar" />
            <include name="wlclient.jar" />
        </fileset>      
     </path>

  <taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask" 
    classpathref="path"/>   

    <!-- Segunda Tarea: Descargamos del CVS la parte de la aplicacion que queramos -->
    <target name="cvs">
        <delete dir="${cvs.Dir}" includeEmptyDirs="true" failonerror="false"/>
        <mkdir dir="${cvs.Dir}"/>
        <!-- se exporta el paquete en modo quiet(q), encriptado(x). La opcion export trae los ficheros sin los archivos de administracion CVS --> 
        <cvs cvsRoot="${cvs.Root}" command="-q -x export"           
            package="indraweb/GCI/IntegracionSAP/MarcarPDF" 
            tag="${cvs.Etiqueta}" 
            dest="${cvs.Dir}"/>
        <!-- Bajar también la dependencia de bibliotecas -->
        <cvs cvsRoot="${cvs.Root}" command="-q -x export" 
            package="indraweb/GCI/IntegracionSAP/BibliotecasWS"
            tag="${cvs.Bibliotecas}" 
            dest="${cvs.Dir}"/>
    </target>

  <target name="server" depends="clean,cvs">
    <mkdir dir="${cvs.Dir}/dist"/>

    <!--quitar el debug a true para produccion-->
    <jwsc debug="true"
      srcdir="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/src"
      destdir="${cvs.Dir}/dist"
      keepGenerated="true"
      verbose="false" >
      <classpath>

        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/BibliotecasWS/lib/jaxrpc.jar"/>
        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/BibliotecasWS/lib/log4j-1.2.8.jar"/>

        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib/indra.jar"/>        
        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib/jaxrpc.jar"/>
        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib/log4j-1.2.8.jar"/>   
        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib/rowset.jar"/>
        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib/multiidioma_ws.jar" />       
        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib/commons-codec-1.4.jar"/>
        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib/commons-logging-1.1.1.jar"/>
      <!--  <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib/mul.jar" /> -->
        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/BibliotecasWS/lib/weblogic.jar"/>
        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/BibliotecasWS/lib/webservices.jar"/>
        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/BibliotecasWS/lib/wlfullclient.jar"/>
        <!--Nuevos jar incluidos, cogidos del portal donde estaba el WS -->
        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib/fontBox-2.0.3.jar"/>
        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib/pdfbox-2.0.3.jar"/>

        <!--
        <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib/FontBox-0.1.0-dev.jar"/>
         <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib/fontbox-0.8.0-incubating.jar"/>
         <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib/PDFBox-0.7.3.jar"/>
         <pathelement path="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib/pdfbox-0.8.0-incubating.jar"/>
         -->    

<!--Nuevos jar incluidos, cogidos del portal donde estaba el WS -->
     </classpath>
        <jws file="/Gci/ws/MarcarPDF.java">

        </jws>
    </jwsc>

    <mkdir dir="${cvs.Dir}/build"/>
    <copydir dest="${cvs.Dir}/build/WEB-INF/classes" 
        src="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/conf/desarrollo"></copydir>

    <copy todir="${cvs.Dir}/build/WEB-INF/lib">
        <fileset dir="${cvs.Dir}/indraweb/GCI/IntegracionSAP/BibliotecasWS/lib">
            <include name="jaxrpc.jar"/>
            <include name="log4j-1.2.8.jar"/>
        </fileset>
        -

        <fileset dir="${cvs.Dir}/indraweb/GCI/IntegracionSAP/MarcarPDF/lib">
            <include name="indra.jar"/>
            <include name="rowset.jar"/>
            <include name="multiidioma_ws.jar"/>
<!--Nuevos jar incluidos, cogidos del portal donde estaba el WS -->             
            <include name="commons-codec-1.4.jar"/>
            <include name="commons-logging-1.1.1.jar"/>
            <!--
            <include name="FontBox-0.1.0-dev.jar"/>
            <include name="fontbox-0.8.0-incubating.jar"/>
            <include name="PDFBox-0.7.3.jar"/>
            <include name="pdfbox-0.8.0-incubating.jar"/>
            -->
            <include name="fontbox-2.0.3.jar"/>
            <include name="pdfbox-2.0.3.jar"/>
<!--Nuevos jar incluidos, cogidos del portal donde estaba el WS -->
        </fileset>          
    </copy>

    <war destfile="${cvs.Dir}/dist/Gci/ws/MarcarPDF.war" update="true"
        basedir="${cvs.Dir}/build"/>
    <ear basedir="${cvs.Dir}/dist" destfile="${cvs.Dir}/dist/MarcarPDF.ear" 
            appxml="${cvs.Dir}/dist/META-INF/application.xml">
     </ear> 

  <copy todir="${path.aplicacion}">
        <fileset dir="${cvs.Dir}/dist">
            <include name="MarcarPDF.ear"/>
        </fileset>
 </copy>

  </target>


</project>

-
这是我的图书馆列表

使用Ant构建项目时,我出现以下错误:

生成失败D:..\BUILD_desarrolo.xml:46: java.lang.NoClassDefFoundError:com/sun/javadoc/ProgramElementDoc


求你了!!帮我一把

也许您需要导入这个库:在JDK中,应该有一个
tools.jar
库。失败的类位于该Jar中。您引用的是JRE而不是JDK,这就是您在ref libraries.ASR中看不到tools.Jar的原因,似乎您是对的,问题在于这个。但是我不知道如何在JDK而不是JRE中实现tools.jar。我还在oracle社区中发现了此线程。