We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,183 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

help fixing an ant build for java

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>

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

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

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

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

</project>
1
Contributor
1
Reply
1 Hour
Discussion Span
6 Months Ago
Last Updated
2
Views
Question
Answered
Goldfinch
Junior Poster in Training
55 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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"/>
Goldfinch
Junior Poster in Training
55 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Self-Answered as of 6 Months Ago

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0570 seconds using 2.67MB