I have a build.xml file that works fine. The problem is that the generated jar file, and I need to run it without 'ant run'
How can I run the jar file? running with
java -jar Main.jar main.Main
gives me:
Exception in thread "main" java.lang.NoClassDefFoundError: org/neo4j/graphdb/GraphDatabaseService
This is how I'm creating the jar file (build.xml):
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile= "${jar.dir}/${ant.project.name}.jar" basedir="${build.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>
<target name="compile">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/${conf.dir}"/>
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="classpath" includeantruntime="false"/>
<copy todir="${build.dir}/${conf.dir}">
<fileset dir="${conf.dir}"/>
</copy>
</target>
<target name="run" >
<java fork="true" classname="${main-class}">
<classpath>
<path refid="classpath"/>
<path location="${jar.dir}/${ant.project.name}.jar"/>
</classpath>
</java>
</target>
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
The "ant run" task works fine with this jar. How can I run this project without ant?