selenium - java.lang.NoClassDefFoundError + ant - running a jar -


tagging- selenium in case faced similar issue while creating selenium tests using ant.

i have seen lot of questions/answers on topic, tried options suggested on various forums still issue not getting resolved. compile code(includes test scripts), create jar , run same jar. reason not seem identify libraries during run time. same code(with tests) works fine when main() method run eclipse. here build.xml,

<project default="run">  <target name="clean">     <delete dir="build" /> </target>  <target name="init-classpath">     <path id="lib.classpath">         <fileset dir="./lib/">             <include name="**.jar" />         </fileset>     </path>     <pathconvert property="mf.classpath" pathsep=" ">         <path refid="lib.classpath" />         <flattenmapper />     </pathconvert> </target>  <target name="jar" depends="clean, init-classpath">     <javac classpathref="lib.classpath" destdir="./compiled" failonerror="true" srcdir="./src" />     <mkdir dir="build/jar" />     <jar destfile="build/jar/banc.jar" basedir="compiled">         <manifest>             <attribute name="main-class" value="com.portico.driver.testdriver" />             <attribute name="class-path" value="${mf.classpath}" />         </manifest>     </jar> </target>  <target name="run" depends="jar">     <java jar="build/jar/banc.jar" fork="true">     </java> </target>  </project> 

error:-exception in thread "main" java.lang.noclassdeffounderror: jxl/workbook

manifest content

manifest-version: 1.0 ant-version: apache ant 1.8.3 created-by: 1.6.0_41-b02 (sun microsystems inc.) main-class: com.portico.driver.testdriver class-path: activation.jar commons-lang-2.4.jar jna-3.4.0.jar jxl.jar   logging-selenium-1.2.jar mail.jar ojdbc14.jar poi-3.0.2-final.jar rep  ortng-1.1.1.jar saxon-8.7.jar selenium-grid-demo-1.0.7.jar selenium-g  rid-demo-standalone-1.0.7.jar selenium-grid-hub-1.0.7.jar selenium-gr  id-hub-standalone-1.0.7.jar selenium-grid-remote-control-1.0.7.jar se  lenium-grid-remote-control-standalone-1.0.7.jar selenium-grid-tools-1  .0.7.jar selenium-grid-tools-standalone-1.0.7.jar selenium-server-1.0  .3-standalone.jar selenium-server-standalone-2.33.0.jar sikuli-script  .jar testng-6.8.jar velocity-1.7.jar 

the first thing check is, whether problem connected manifest or else. if can run application java -cp <allthejarfiles> <main-class> problem connected manifest. keep in mind jar files specified in manifest relative jar file’s location. trying run application -verbose:class option gives hint jar loaded.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -