Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>Exception java.lang.NoClassDefFoundError</code> occurs when some class, yours or in a library your code depends on, try to use a symbol not already loaded. The class loader use the java path <code>package_aa.package_bb.SomeClass</code> as a key into the set of of classes it knows, specified by -classpath or -cp. In your case this "repository is <code>bin, libthrift-1.0.0-javadoc.jar, libthrift-1.0.0.jar, log4j-1.2.14.jar, slf4j-api-1.5.8.jar, slf4j-log4j12-1.5.8.jar</code>.</p> <p>In your context, when the class p1.p2.Client is about to be loaded, the classloader looks for bin/p1/p2/Client.class, look for /p1/p2/Client.class into each jar and when all the search paths are exhausted, the exception is thrown.</p> <p>In this part of your build.xml :</p> <pre><code>&lt;target name="jar" depends="init"&gt; &lt;mkdir dir="build/jar" /&gt; &lt;jar destfile="client.jar" basedir="bin"&gt; &lt;manifest&gt; &lt;attribute name="Main-Class" value="src.Client" /&gt; &lt;/manifest&gt; &lt;/jar&gt; &lt;/target&gt; </code></pre> <p><code>value="src.Client"</code> is wrong, it should be the logical java path i.e. the package + the class name. src is a directory not a package. If you haven't any package, it's just classname.</p> <p>I presume</p> <pre><code>&lt;attribute name="Main-Class" value="Client" /&gt; </code></pre> <p>That should do the trick.</p> <p>Reference:</p> <ul> <li><a href="http://ant.apache.org/manual/Tasks/jar.html" rel="nofollow">Apache ANT Manual for Jar task</a>.</li> <li><a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jar.html#entrypoint" rel="nofollow">Oracle Jar Tools Manual (entry point)</a></li> </ul> <p><strong>EDIT</strong> after first debug, the second error appears:</p> <pre><code>&lt;target name="run" depends="jar"&gt; &lt;java jar="client.jar" fork="true"&gt; &lt;/java&gt; &lt;/target&gt; </code></pre> <p>Can't work because Client.jar is not autonomous, it requires a lot of depndencies, which aren't specified here. You should use the classpath ref defined on top of your build.xml.</p> <p>It <em>may be</em> wrote as:</p> <pre><code>&lt;target name="run" depends="jar"&gt; &lt;java classpathref="client.classpath" fork="true" classname="Client" /&gt; &lt;/target&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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