Mark R Mark R - 9 months ago 152
Java Question

RWeka throws java.lang.UnsupportedClassVersionError under OSX 10.10.5

I'm getting the following error message with RWeka 0.4-28 under OS 10.5.5 when I try to create classifiers:

Error in .jnew("weka/core/Attribute", attname[i], .jcast(levels,
"java/util/List")) : java.lang.UnsupportedClassVersionError:
weka/core/Attribute : Unsupported major.minor version 51.0

I've checked in terminal and my Java is up-to-date

java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)

Is this a bug in RWeka or something with my configuration?

ck1 ck1
Answer Source

Are you sure that you're running RWeka using JDK 8? Based on the UnsupportedClassVersionError, it appears you're running the application using JDK 6. major.minor version 51.0 indicates that the classes for RWeka were compiled with JDK 7, which should be handled fine by JDK 8 (but not by JDK 6).

Can you provide the output of the following command in your terminal? Also, can you provide more details about how you're launching the app, e.g. using a shell script, Launchpad icon in the Dock, etc.

$ java -version

Update: have you tried updating R to use JDK 8?

$ sudo R CMD javareconf