MäxL
MäxL

Reputation: 195

How to run main() Method with Ant Script?

I just want to run the main() - Method of a java class by double clicking my the ant task in eclipse ant - view. My Problem is, I don't know how to write the ant file exactly. My ant file should be analyzeDatabase.xml.

I tried something like this, but always fails:

<?xml version="1.0" ?>
<project name="DBAnalyzer" default="run" basedir=".">
    <target name="run" description="runs dbanalyzer">
        <java classname="DBAnalyzer">
            <arg value="-h"/>
        </java>
    </target>
</project>

enter image description here

Upvotes: 4

Views: 11929

Answers (1)

Ostap Andrusiv
Ostap Andrusiv

Reputation: 4907

Change <java classname="DBAnalyzer"> to fully qualified name. And don't forget to double-check your classpath.

<java classname="com.prostep.openpdm.db.analyzer.DBAnalyzer">
    <arg value="-h"/>
    <classpath>
        <pathelement path="${your.java.class.path}"/>
    </classpath>
</java>

Full description on Ant Java Task is here: http://ant.apache.org/manual/Tasks/java.html

Upvotes: 7

Related Questions