
看起来您的运行时类路径缺少包含类 org.supercsv.io.ICsvBeanReader 的jar 。
在 疑难杂症 的是,调用一个可执行的JAR,当你不能从命令行设置类路径。您必须在清单中进行如下设置:
<target name="dist" depends="compile" description="Generates distributable"> <!-- creates the distribution directory --> <mkdir dir="${dist}/lib" /> <!-- Remove manifest. This jar will end up on the classpath of CC.jar --> <jar jarfile="${dist}/lib/CC-${DSTAMP}.jar" basedir="${build}"/> <!-- Fancy task that takes the pain out creating properly formatted manifest value --> <manifestclasspath property="mf.classpath" jarfile="${dist}/lib/CC.jar"> <classpath> <fileset dir="${dist}/lib" includes="*.jar"/> </classpath><!--end tag--> </manifestclasspath> <!-- This is the executable jar --> <jar jarfile="${dist}/lib/CC.jar" basedir="${build}"> <manifest> <attribute name="Main-Class" value="jab.jm.main.Test"/> <attribute name="Class-Path" value="${mf.classpath}"/> </manifest> </jar></target>这种方法将允许您按以下方式运行jar:
java -jar CC.jar
如果没有多余的清单条目,则必须按如下所示运行jar:
注意java -cp CC.jar:CC-DSTAMPVALUE.jar jab.jm.main.Test
只有CC.jar是可执行文件,并且需要特殊的清单。使用此模式意味着放置在lib目录中的将来的其他jar将自动包含在运行时类路径中。(对于诸如log4j之类的开源依赖项很有用)
显然,如果不存在jar文件,则在运行CC.jar时也会出现类似错误:-)
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)