Eclipse Ant Builder problem

Posted by styx777 on Stack Overflow See other posts from Stack Overflow or by styx777
Published on 2010-04-26T17:35:24Z Indexed on 2010/04/26 18:23 UTC
Read the original article Hit count: 174

Filed under:
|
|
|

I made a custom ant script to automatically create a jar file each time I do a build.

This is how it looks like:

<?xml version="1.0" encoding="UTF-8"?>

<project name="TestProj" basedir="." default="jar">
  <property name="dist" value="dist" />
  <property name="build" value="bin/test/testproj" />
  <target name="jar">
      <jar destfile="${dist}/TestProj.jar">
          <manifest>
              <attribute name="Main-Class" value="test.testproj.TestProj" />
          </manifest>
          <fileset dir="${build}" />
      </jar>
  </target>
</project> 

I added it by Right clicking my project > properties > builders > clicked new > Ant builder > then I specified the location of the above xml file.

However, when I run it by doing:

java -jar TestProj.jar

I get a NoClassDefFoundError test/testproj/TestProj

I'm using Eclipse in Ubuntu. TestProj is the name of the class and it's in package test.testproj

I'm pretty sure there's something wrong with the manifest and probably the location of the xml file as well but I'm not sure how to fix this. Any ideas?

© Stack Overflow or respective owner

Related posts about eclipse

Related posts about ant