问题
This is my first time using weka, I am sorry if my question seems naive. But I was really stuck by this problem.
I am using weka in my own java project in eclipse. I have successfully import weka.jar with attached wekasource.jar. But when I ran the program, all the weka class always failed to be initialized(attribute, Fastvector etc.). All the exceptions are the same:
InvocationTargetException
I check the error stack where showed: java.lang.NoClassDefFoundError: weka/core/attribute
Additional Info: I tried to create a new project in eclipse ,and use weka, it works. But it still can not work in my own existing project.
Does anyone have some ideas how should I solve this problem?
回答1:
It seems I have solved this weird problem. The solution is simple:
right click on the project, in the java build path, check weka.jar in order and export tab.
Hope it can help the later people who face the similar problem
来源:https://stackoverflow.com/questions/17399901/weka-class-cannot-be-initialized-invocationtargetexception