1

I recently installed package r2pmml and all its dependencies in R. However, when I'm trying to convert my gbm model object to pmml it throws this error:

r2pmml::r2pmml(model,"model.pmml")

Error in .jnew("org/jpmml/rexp/Main") : 
java.lang.UnsupportedClassVersionError: org/jpmml/rexp/Main : Unsupported major.minor version 51.0

I'm a noob when it comes to java and any help is appreciated!

Book Of Zeus
  • 49,509
  • 18
  • 174
  • 171
outlier123
  • 217
  • 1
  • 2
  • 10

1 Answers1

1

You are using an outdated Java version, which does not support Java 1.7 class files - please upgrade. The requirement for Java 1.7 is also stated in r2pmml's README file.

To debug your rJava configuration, please execute the following R script:

library("rJava")
.jinit()
props = .jcall("java/lang/System", "Ljava/util/Properties;", "getProperties")
out = .jfield("java/lang/System", "Ljava/io/PrintStream;", "out")
.jcall(props, "V", "list", out)

Please observe the value of the java.home property. It must point to a up-to-date Java installation.

Community
  • 1
  • 1
user1808924
  • 4,563
  • 2
  • 17
  • 20
  • Thanks for your answer! I did update my java version to 1.8, but I still get the same error! -- $ java -version java version "1.8.0_65" Java(TM) SE Runtime Environment (build 1.8.0_65-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode) – outlier123 Nov 24 '15 at 16:35
  • Did you restart your R session also? It is likely that the rJava package still holds a reference to the old Java version. – user1808924 Nov 24 '15 at 16:59
  • I did restart both my mac and R. Any other suggestions? – outlier123 Nov 24 '15 at 18:14
  • Also, how do I check which version rJava is referring to? – outlier123 Nov 24 '15 at 18:42
  • Is the system-level environment variable `JAVA_HOME` set? Will try to work out a R snippet that calls rJava to figure out the JVM in use. – user1808924 Nov 24 '15 at 18:46
  • Actually that's the part I'm not clear on. Do I need to set it in bash_profile? I'm not sure how to do it though. Could you please walk me through it? – outlier123 Nov 24 '15 at 19:27
  • Did you manage to locate the outdated Java installation that rJava chose over the new Java 1.8 one? You could try uninstalling that old version as the first step. I don't have experience working with Mac, so you need to do the googling yourself. – user1808924 Nov 24 '15 at 19:39
  • When I load rJava, the message I get tells me to install JRE 1.6 although it admits that this is below the version 1.8 that I have installed. The text of the popup message starts out:"To open “R” you need to install the legacy Java SE 6 runtime." – IRTFM Dec 30 '15 at 00:30