• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

showing missing execute()

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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-----

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
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 & 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic