You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2012/02/01 14:18:56 UTC

DO NOT REPLY [Bug 52533] Error no public execute() in class

https://issues.apache.org/bugzilla/show_bug.cgi?id=52533

--- Comment #2 from Nguyen Anh Tuan <an...@gmail.com> 2012-02-01 13:18:56 UTC ---
Hi, I've passed this problem, 
when i change the class name from HelloWorld to HW, it's working. But I'dont
know why. My class is very simple:

public class HelloWorld {
    public void execute() {
        System.out.println("Hello World");
    }
}

Thank for interesting

(In reply to comment #0)
> I use ant 1.8, java 1.6, windows xp. when i defined a task with taskdef. It
> showed as following:
> 
> D:\jv\Project\Test1>ant use -verbose
> Apache Ant(TM) version 1.8.2 compiled on December 20 2010
> Trying the default build file: build.xml
> Buildfile: D:\jv\Project\Test1\build.xml
> Detected Java version: 1.6 in: D:\Program Files\Java\jdk1.6.0_25\jre
> Detected OS: Windows XP
> parsing buildfile D:\jv\Project\Test1\build.xml with URI =
> file:/D:/jv/Project/T
> est1/build.xml
> Project base dir set to: D:\jv\Project\Test1
> parsing buildfile
> jar:file:/D:/apache-ant-1.8.2/lib/ant.jar!/org/apache/tools/an
> t/antlib.xml with URI =
> jar:file:/D:/apache-ant-1.8.2/lib/ant.jar!/org/apache/to
> ols/ant/antlib.xml from a zip file
> Build sequence for target(s) `use' is [compile, jar, use]
> Complete build sequence is [compile, jar, use, clean, ]
> 
> compile:
>     [mkdir] Skipping D:\jv\Project\Test1\classes because it already exists.
>     [javac] D:\jv\Project\Test1\build.xml:14: warning: 'includeantruntime' was
> n
> ot set, defaulting to build.sysclasspath=last; set to false for repeatable
> build
> s
>     [javac] HelloWorld.java omitted as
> D:\jv\Project\Test1\classes\HelloWorld.cl
> ass is up to date.
>     [javac] D:\jv\Project\Test1\src\HelloWorld.javax skipped - don't know how
> to
>  handle it
> 
> jar:
>       [jar] HelloWorld.class omitted as
> D:\jv\Project\Test1\MyTask.jar:HelloWorl
> d.class is up to date.
>       [jar] No sources found.
>       [jar] No Implementation-Title set.No Implementation-Version set.No
> Impleme
> ntation-Vendor set.
>       [jar] Location: D:\jv\Project\Test1\build.xml:18:
> 
> use:
> No public execute() in class HelloWorld
>   [taskdef] Warning: No public execute() in class HelloWorld
> 
> BUILD FAILED
> D:\jv\Project\Test1\build.xml:24: Problem: failed to create task or type hl
> Cause: The name is undefined.
> Action: Check the spelling.
> Action: Check that any custom tasks/types have been declared.
> Action: Check that any <presetdef>/<macrodef> declarations have taken place.
> 
>         at
> org.apache.tools.ant.UnknownElement.getNotFoundException(UnknownEleme
> nt.java:487)
>         at
> org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:41
> 9)
>         at
> org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.jav
> a:163)
>         at org.apache.tools.ant.Task.perform(Task.java:347)
>         at org.apache.tools.ant.Target.execute(Target.java:390)
>         at org.apache.tools.ant.Target.performTasks(Target.java:411)
>         at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
>         at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
> cutor.java:41)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
>         at org.apache.tools.ant.Main.runBuild(Main.java:809)
>         at org.apache.tools.ant.Main.startAnt(Main.java:217)
>         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
>         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
> 
> Total time: 0 seconds
> 
> but i've seen in my class had the execute() method. I've tried many ways but my
> problem is not resolve. Please help me!

(In reply to comment #1)
> Hard to tell without seeing the code for your HelloWorld class.  Is the
> signature of execute the one expected by Ant (public void, no arguments, no
> checked exceptions)?  Is the class itself public?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.