javawekamtj

Weka 3.8.1 can't link to mtj.jar, causing java.lang.ClassNotFoundException: no.uib.cipr.matrix.Matrix


I'm processing the some data in weka, and I want to use weka API so that I can use my self-defined algorithms. However, when I just want to instantiate the LinearRegression class: LinearRegression myRegression = new LinearRegression() I got the same error as: This person got the same problem and he roll back to version 3.6.12 I checked my weka.jar and I can find mtj.jar is included, so I'm sure there must be somewhere linked inapproriately. Downgrade the API version is not the best option for me because I want to use new class RegressionAnalysis. Any help thanks.


Solution

  • My current solution is a hack, I downloaded mtj.jar and added this .jar lib to my external lib. This hack will resolve:

    java.lang.ClassNotFoundException: no.uib.cipr.matrix.Matrix
    

    However, this hack has a flaw that it will bring up a warning:

    WARNING: Failed to load implementation from: com.github.fommil.netlib.NativeRefBLAS

    Update:

    Same solution could apply to get rid of the warning as well.