0

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?

Psidom
  • 209,562
  • 33
  • 339
  • 356
Mark R
  • 775
  • 1
  • 8
  • 23

2 Answers2

2

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
ck1
  • 5,243
  • 1
  • 21
  • 25
  • How would I check that? From terminal or within R? – Mark R Jun 04 '16 at 21:23
  • java version "1.8.0_92" Java(TM) SE Runtime Environment (build 1.8.0_92-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode) – Mark R Jun 04 '16 at 21:36
  • And I run RWeka from RStudio – Mark R Jun 04 '16 at 21:37
  • `sudo R CMD javareconf` runs without error, and I uninstalled and reinstalled rJava and RWeka . . . but still the same error! – Mark R Jun 05 '16 at 14:22
  • I cleared out all traces of Java 6 and then got things working with http://stackoverflow.com/questions/30738974/rjava-load-error-in-rstudio-r-after-upgrading-to-osx-yosemite) Thanks for pointing me in the right direction – Mark R Jun 06 '16 at 05:49
0

You might have to replace the /usr/bin/java symlink so that it points to /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java instead:

sudo rm /usr/bin/java
sudo ln -s /Library/Internet\ PlugIns/JavaAppletPlugin.plugin/Contents/Home/bin/java /usr/bin