Note that there are some explanatory texts on larger screens.

plurals
  1. PORun a Java Program from an Ant Build File
    primarykey
    data
    text
    <p>So I wrote an ant build.xml file where I take the class files from two Java programs, one that extends the other, package them up into two separate jar files, and then, launches them.</p> <pre><code>&lt;java classname="Main"&gt; &lt;classpath&gt; &lt;pathelement location="${mainDir}"/&gt; &lt;pathelement path="${Main-Class}"/&gt; &lt;/classpath&gt; &lt;/java&gt; </code></pre> <p>Whenever I invoke ant, it says that "Main" can not be found. I can post the rest of the build.xml file if needed but it's really just this part that I'm confused about. I'm pretty sure that I have the classname right but my biggest problem is figuring out what goes in for location and path. Right now I just have dummy variables.</p> <p>EDIT: Here's the whole file.</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;project default="dist" name="webscarab"&gt; &lt;description&gt;Class&lt;/description&gt; &lt;property name="ClassFiles" location="..\Simple\trunk\dev\Class\bin\" /&gt; &lt;property name="mainClassFiles" location="..\Simple\trunk\dev\main\build\" /&gt; &lt;property name="buildDir" location=".\build" /&gt; &lt;property name="distDir" location=".\dist" /&gt; &lt;property name="mainDir" location="..\Simple\trunk\dev\webscarab\src\" /&gt; &lt;target name="init"&gt; &lt;tstamp/&gt; &lt;mkdir dir="${buildDir}"/&gt; &lt;mkdir dir="${distDir}"/&gt; &lt;/target&gt; &lt;target name="dist" depends="init"&gt; &lt;jar destfile="${distDir}/package${DSTAMP}.jar" basedir="${ ClassFiles}"/&gt; &lt;jar destfile="${distDir}/package-web-${DSTAMP}.jar" basedir="${mainClassFiles}"/&gt; &lt;java classname="Main"&gt; &lt;classpath&gt; &lt;pathelement location="${mainDir}"/&gt; &lt;pathelement path="${Main-Class}"/&gt; &lt;/classpath&gt; &lt;/java&gt; &lt;/target&gt; &lt;/project&gt; </code></pre> <p>EDIT 2: I should mention everything is already compiled and I have all the .class files. It's not something I need to do in the Ant file.</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.
    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