Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7609729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:14:38+00:00 2026-05-31T01:14:38+00:00

In my eclipse plugin, I am trying to execute an Ant task and to

  • 0

In my eclipse plugin, I am trying to execute an Ant task and to redirect the output to the eclipse console
Here is my code:

    AntRunner runner = new AntRunner();
    runner.addBuildLogger("myplugin.AntLogger");        

    String projectPath = getProject().getLocation().toString();
    String buildFileLocation = projectPath + File.separator + "build.xml";
    runner.setBuildFileLocation(buildFileLocation);
    runner.setExecutionTargets(new String[] { "build-for-device" });

The AntLogger code is:

public class AntLogger extends org.apache.tools.ant.DefaultLogger {

private IOConsole console = new IOConsole("Ant", null);
private IOConsoleOutputStream outputStream = console.newOutputStream();

public AntLogger() {
    ConsolePlugin.getDefault().getConsoleManager()
            .addConsoles(new IConsole[] { console });
}

@Override
protected void printMessage(String message, PrintStream stream, int priority) {
    super.printMessage(message, stream, priority);
    try {
        outputStream.write(message + "\n");
    } catch (IOException e) {
        e.printStackTrace();
    }
}

}

and I added the ant.jar to the plugin.xml

<extension
     point="org.eclipse.ant.core.extraClasspathEntries">
  <extraClasspathEntry
        library="ant.jar">
  </extraClasspathEntry>
</extension>

No matter what I do I keep getting class not found exception:

java.lang.NoClassDefFoundError: org/apache/tools/ant/DefaultLogger
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:626)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:608)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:562)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:486)
    at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:459)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
    at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
    at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
    at org.eclipse.ant.core.AntCorePreferences$WrappedClassLoader.findClass(AntCorePreferences.java:116)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.ant.internal.core.AntClassLoader.loadClassPlugins(AntClassLoader.java:69)
    at org.eclipse.ant.internal.core.AntClassLoader.findClass(AntClassLoader.java:47)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.eclipse.ant.internal.core.ant.InternalAntRunner.createLogger(InternalAntRunner.java:747)
    at org.eclipse.ant.internal.core.ant.InternalAntRunner.addBuildListeners(InternalAntRunner.java:202)
    at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:572)
    at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:498)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.ant.core.AntRunner.run(AntRunner.java:378)
    at org.eclipse.ant.core.AntRunner.run(AntRunner.java:475)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:14:40+00:00Added an answer on May 31, 2026 at 1:14 am

    After banging my head over this I finally found the solution:

    The AntLogger class cannot be part of the plugin project.
    I moved the AntLogger to a different java project named it EclipseAntLogger, then I added the project jar to the plugin extension point like this:

    <extension
         point="org.eclipse.ant.core.extraClasspathEntries">
      <extraClasspathEntry
            library="lib/EclipseAntLogger.jar">
      </extraClasspathEntry>
    </extension>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to install Googles' eclipse plugin - http://code.google.com/eclipse/docs/getting_started.html Even on following all
I'm new to eclipse plugin development, and I inherited some Eclipse plugin code and
I'm trying to install Aptana Studio as Eclipse plugin in Eclipse 3.3 (Europa), and
I am trying to install the m2eclipse plugin in Eclipse 3.5 on Ubuntu 9.04
I'm trying to access a Subversion repository with an integration plugin in Eclipse 3.2.2.
Trying to work with Eclipse for Android (ADT plugin) development at my iMac (2.4Ghz,
i installed eclipse/galileo on mac x 10.5. i'm trying to install subversion plugin, but
I'm using the PyDev for Eclipse plugin, and I'm trying to set a break
I have a maven project imported into Eclipse. I'm trying to understand the code
I'm trying to build my first Eclipse Plugin (under Indigo). I created a Popup

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.