I was trying to building a java project with a run function. Problem is, the build file is located at the base directory and file with the main method is in the /contents/username/ subdirectory - I can't seem to properly call the file even though when I run Ant compile, the .java with the main method is compiled without a problem

<project name="build" default="compile">
    <target name="compile" depends="clean">
        <javac srcdir="." includeantruntime="false"/>

    <target name="clean">
            <fileset dir="." includes="**/*.class"/>
            <fileset dir="." defaultexcludes="no" includes="**/*~"/>
        <delete dir="META-INF" failonerror="false"/> 

    <target name="run" depends="compile, who">
        <java classname="Driver" classpath="./contents/username" fork="yes"/>

    <target name="who">
        <echo message="Written by ****, is that a good thing?"/>

    <target name="jar">
        <jar destfile="./username.jar"> 
            <fileset dir="." includes="**/*.java, build.xml"/>


Edited 4 Years Ago by Goldfinch

I'm not sure if it's polite to post my own solution before I hear from anyone else, but I found a solution that works. Replace line 15 with:

<java classname="contents.username.Driver" fork="yes"/>
This question has already been answered. Start a new discussion instead.