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
- Added my external weka.jar under Classpath and clicked on Finish:
- Created class
Testing.java
in packagemyweka
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:
- 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
- Import the project as an Existing Maven Project
- Select the directory where your
pom.xml
is located and click on Finish.
- Once Eclipse has finished the import, you can execute the
myweka.Testing
class, which will just output the filter's classname in the console.