wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes showing missing execute() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "showing missing execute()" Watch "showing missing execute()" New topic
Author

showing missing execute()

sandeep kumar jangra
Greenhorn

Joined: Jan 12, 2005
Posts: 29
hi frenz, I m new to ant. I m using ant1.6.2 and while trying an example the ant is showing error as missing execute method whereas I have that in my program.can u tell me wots going wrong. build file and java program are as follows:

java program-----

import org.apache.tools.ant.Project;

public class HelloWorld {

private Project project;

public void setProject(Project proj) {
project = proj;
}

public void execute() {
String message = project.getProperty("ant.project.name");
project.log("Here is project '" + message + "'.", Project.MSG_INFO);
}
}
-----------------------------------------------------

build file-----

<?xml version="1.0"?>
<!DOCTYPE project>
<project name="AntProject" default="use" basedir=".">
<property name="src" value="src"/>
<property name="build" value="build"/>
<property name="dist" value="dist"/>

<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
</target>

<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${build}"/>
</target>

<target name="dist" depends="compile">
<mkdir dir="${dist}/lib"/>
<jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
</target>

<target name="use" depends="compile">
<taskdef name="HelloWorld" classname="HelloWorld" classpath="${build}"/>
<HelloWorld/>
</target>

</project>

-------------------------------------------------
kindly solve my problem. thanx in advance
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
I just copied your build.xml and your java code. build.xml in base directory and the java in the src directory. Ran ant & voila...no error.

Maybe you should check what ant version is really running?

Here's mine:
C:\_Work\java>ant -version
Apache Ant version 1.6.2 compiled on July 16 2004
C:\_Work\java>java -version
java version "1.4.1_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_05-b01)
Java HotSpot(TM) Client VM (build 1.4.1_05-b01, mixed mode)

Here's my successfuly run of your code/build:
C:\_Work\java>ant
Buildfile: build.xml

init:
[mkdir] Created dir: C:\_Work\java\build

compile:
[javac] Compiling 1 source file to C:\_Work\java\build

use:
Here is project 'AntProject'.

BUILD SUCCESSFUL
Total time: 4 seconds
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: showing missing execute()
 
Similar Threads
error #300 & #302: cannot access class
Ant, JAR files, and the associated 'Paths' created in the JAR file - help!
JAVA DOC
How to Jar?
build.xml ... what am I doing wrong?