Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

showing missing execute()  RSS feed

sandeep kumar jangra
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!