How to run main () method with Ant Script?

I just want to run the main() method of the Java class by double-clicking on it the ant task in eclipse ant - view. My problem is that I do not know how to write the ant file correctly. 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

+4
source share
1 answer

Change <java classname="DBAnalyzer"> to the full name. And don't forget to double check your class path.

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

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

+7
source

All Articles