Search code examples
javamatrixrstudiorjavarweka

Using RWeka M5P in RStudio yields java.lang.NoClassDefFoundError: no/uib/cipr/matrix/Matrix


I have an R Script which used to work fine where I use RWeka's M5P-algorithm.

For reasons unknown to me, it stopped working properly and now I get

Error in .jcall(o, "Ljava/lang/Class;", "getClass") : 
    java.lang.NoClassDefFoundError: no/uib/cipr/matrix/Matrix

Presumably this has something to do with me updating RStudio or Windows or R or some package. The odd thing is, that the script works fine when I run it from the simple R gui. So this seems to be related to RStudio and rJava (a possible problem source pointed out here). Still, I don't know how to fix this, all advice I read so far concerns MacOS or Linux, but I am on Windows 10. My Java version is

java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) Client VM (build 25.72-b15, mixed mode)

My colleague can run the same script without problems on Windows 10 (same updates due to company policy) and RStudio (same version: 1.0.136). Her Java version is

java version "1.8.0_101",
Java(TM) SE Runtime Environment (build   1.8.0_101-b13),
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

So it seems to be some accidental misconfiguration on my PC but I just don't know where to look.

Can anyone help me?

platform x86_64-w64-mingw32 arch x86_64
os mingw32 system x86_64, mingw32 status major 3 minor 3.2
year 2016 month 10
day 31 svn rev 71607
language R version.string R version 3.3.2 (2016-10-31) nickname Sincere Pumpkin Patch


Solution

  • After reading RWeka Odds and Ends I realized, that my WEKA_HOME was set to a path in my profile and that the Weka package manager (WPM) seemed to have problems with saving the necessary modules. The solution was to set the path to my hard drive and refresh the cache.

    Sys.getenv("WEKA_HOME") # where does it point to? Maybe some obscure path? 
    # if yes, correct the variable:
    Sys.setenv(WEKA_HOME="C:\\MY\\PATH\\WEKA_WPM")
    library(RWeka)
    WPM("list-packages", "installed")
    

    Afterwards, everything got back to normal and M5P worked like before.