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?