Home > front end >  Weka Filter class is not found
Weka Filter class is not found

Time:12-01

Writing code on Eclipse with Weka. Trying to use the weka.filters.Filter method but I constantly receive this error:

java.lang.NoClassDefFoundError: weka/filters/Filter

Everything else seems to be imported right and I see the filter class in the Package Exploration.

Thank you to everyone in advance

CodePudding user response:

Haven't used Eclipse in a long time, as I prefer enter image description here

  1. Added my external weka.jar under Classpath and clicked on Finish:

enter image description here

  1. Created class Testing.java in package myweka with this content:
package myweka;

import weka.filters.Filter;
import weka.filters.MultiFilter;

public class Testing {

    public static void main(String[] args) throws Exception {
        Filter f = new MultiFilter();
        System.out.println(f);
    }
}

Here it is what it looks like in Eclipse:

enter image description here

  1. Executed the class without problems (just outputs the classname in the console).

CodePudding user response:

Instead of simply adding an external jar to your project, you could set up a enter image description here

  1. Import the project as an Existing Maven Project

enter image description here

  1. Select the directory where your pom.xml is located and click on Finish.

enter image description here

  1. Once Eclipse has finished the import, you can execute the myweka.Testing class, which will just output the filter's classname in the console.
  • Related