File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

showing missing execute()

sandeep kumar jangra

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-----


public class HelloWorld {

private Project project;

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

public void execute() {
String message = project.getProperty("");
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">
<mkdir dir="${build}"/>

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

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

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


kindly solve my problem. thanx in advance
Carol Enderlin
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 & 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:
Buildfile: build.xml

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

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

Here is project 'AntProject'.

Total time: 4 seconds
I agree. Here's the link:
subject: showing missing execute()
jQuery in Action, 3rd edition