Note that there are some explanatory texts on larger screens.

plurals
  1. POjava.lang.NoClassDefFoundError + ant - running a jar
    text
    copied!<p>Tagging- Selenium as well just in case someone faced similar issue while creating selenium tests using Ant.</p> <p>I have seen lot of questions/answers on this topic, tried all the options suggested on various forums but still my issue is not getting resolved. Basically i compile code(includes the test scripts), create JAR and run the same JAR. For some reason it does not seem to identify the libraries during run time. Same code(With tests) works fine when main() method is run from Eclipse. Here is the build.xml,</p> <pre><code>&lt;project default="run"&gt; &lt;target name="clean"&gt; &lt;delete dir="build" /&gt; &lt;/target&gt; &lt;target name="init-classpath"&gt; &lt;path id="lib.classpath"&gt; &lt;fileset dir="./lib/"&gt; &lt;include name="**.jar" /&gt; &lt;/fileset&gt; &lt;/path&gt; &lt;pathconvert property="mf.classpath" pathsep=" "&gt; &lt;path refid="lib.classpath" /&gt; &lt;flattenmapper /&gt; &lt;/pathconvert&gt; &lt;/target&gt; &lt;target name="jar" depends="clean, init-classpath"&gt; &lt;javac classpathref="lib.classpath" destdir="./compiled" failonerror="true" srcdir="./src" /&gt; &lt;mkdir dir="build/jar" /&gt; &lt;jar destfile="build/jar/BANC.jar" basedir="compiled"&gt; &lt;manifest&gt; &lt;attribute name="Main-Class" value="com.portico.driver.TestDriver" /&gt; &lt;attribute name="Class-Path" value="${mf.classpath}" /&gt; &lt;/manifest&gt; &lt;/jar&gt; &lt;/target&gt; &lt;target name="run" depends="jar"&gt; &lt;java jar="build/jar/BANC.jar" fork="true"&gt; &lt;/java&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <p>Error:-Exception in thread "main" java.lang.NoClassDefFoundError: jxl/Workbook</p> <p>Manifest content</p> <pre><code>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 </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload