简体   繁体   中英

Running a class from within a jar using ant

im trying to invoke a specific class from within a jar file but I'm gettign below exception -

Buildfile: C:\Projects\GranHermano\build.xml
SignJadFilesInDir:
    [java] java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Cell

My jar file contains all required jars (in this case poi-3.6-20091214.jar) so above exception should not be thrown.

This is how I am invoking the class -

<target name="SignJadFilesInDir" description="Signs all jad files in a dir" > 
 <java classname="com.src.SignDeviceJadInDir">
     <classpath>
        <pathelement location="BuildUtils.jar"/>
      </classpath>
  <arg line="${jadFileDir}"/>
  <arg line="${devicesExcelDir}"/>
  <arg line="${wtkDir}"/>
  <arg line="${keyStoreDir}"/>
  <arg line="${keyStoreId}"/>
  <arg line="${keyStorePwd}"/>
 </java>
</target>

Thanks

Can you please open jar BuildUtils.jar to ensure it well contains the classes of poi (and not poi jar, as I'm not aware of JRE support for jar-in-a-jar out of the box) ? If your BuildUtils.jar contains poi-3.6-20091214.jar and not its classes, your exception is quite normal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM