Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed help making build.xml for Ant build of my Java project
    primarykey
    data
    text
    <p>I have a project set up like this;</p> <pre><code>Project -src -com -top -classes Class_3.java Class_4.java -utils Class_5.java Class_6.java Class_1.java Class_2.java -data various files -libs lib_1.jar lib_2.jar lib_3.jar lib_4.jar build.xml </code></pre> <p>class_1.java contains the main class, libs contains external dependencies, data contains various images, text files etc...</p> <p>I have been trying to write an Ant build file to make a distributable JAR file but am having difficultied pulling in all the required libraries etc...</p> <p>This is where I am up to.</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;project name="Project" default="jar"&gt; &lt;property name="libsSrc" value="libs"/&gt; &lt;property name="build" value="build"/&gt; &lt;property name="classes" value="build/classes"/&gt; &lt;property name="jar" value="build/jar"/&gt; &lt;property name="libs" value="build/libs"/&gt; &lt;path id="classpath"&gt; &lt;fileset dir="${libsSrc}" includes="*.jar"/&gt; &lt;/path&gt; &lt;target name="clean" description="remove intermediate files"&gt; &lt;delete dir="build"/&gt; &lt;/target&gt; &lt;target name="compile" description="compile the Java source code to class files"&gt; &lt;mkdir dir="${classes}"/&gt; &lt;javac srcdir="." destdir="${classes}" classpathref="classpath"&gt; &lt;compilerarg line="-encoding utf-8"/&gt; &lt;/javac&gt; &lt;/target&gt; &lt;target name="jar" depends="compile" description="create a Jar file for the application"&gt; &lt;mkdir dir="${jar}"/&gt; &lt;jar destfile="${jar}/App.jar"&gt; &lt;fileset dir="${classes}" includes="**/*.class"/&gt; &lt;manifest&gt; &lt;attribute name="Main-Class" value="com.top.Class_1"/&gt; &lt;/manifest&gt; &lt;/jar&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <p>This doesn't work currently.</p> <p>It compiles with no errors but doesn't include the required dependencies and the JAR cannot find the main class. How can I fix it?</p>
    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.
 

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