CDK-R / cdkr

Integrating R and the CDK
https://cdk-r.github.io/cdkr/
42 stars 27 forks source link

Issues with function get.desc.categories() #54

Closed yangtaotai closed 4 months ago

yangtaotai commented 6 years ago

Hi Rajarsh,

I found some errors this morning while running my code built on rcdk package. Zach mentioned you guys are doing a major update for the packages. I dig into my code and seems like "get.desc.categories()" generate errors like shown below:

Error in .jcall("org/guha/rcdk/descriptors/DescriptorUtilities", "[Ljava/lang/String;", : java.lang.UnsupportedClassVersionError: org/guha/rcdk/descriptors/DescriptorUtilities : Unsupported major.minor version 52.0

I wonder if this is something you guys noticed?

Thank you,

Tao

rajarshi commented 6 years ago

Are you using v3.4.3?

I just tried it and this works fine.

The error message usually arises due an issue in installation and the version of Java that is being used (likely due to multiple JDKs being available on your system).

You could try a fresh install of rJava and then rcdk

yangtaotai commented 6 years ago

I am using 3.4.1 and didn't see 3.4.3 on CRAN yet. what happened to me is that my code ran fine last week but i was trying to run the exactly same code, i had the issues i mentioned earlier. I did update/install rJava and rcdk before and also did this again today but seems like still got the same error. not sure what kind of issue could be? maybe is only for my computer?
language R
version.string R version 3.4.1 (2017-06-30) nickname Single Candle

rajarshi commented 6 years ago

The error originates from a lower version JDK/JRE dealing with classes from a higher version JDK. Can you try upgrading to 3.4.3 and seeing what happens?

hrjn commented 6 years ago

I have a very similar error, but slightly different:

Error in .jcall("org/guha/rcdk/descriptors/DescriptorUtilities", "[Ljava/lang/String;", : RcallMethod: cannot determine object class

Judging from previous messages it might have to do with incompatible JDK versions. I'm currently using 1.7 as suggested by the doc but the Github's README mentions that JDK must be >=1.8. Which one to trust?

zachcp commented 6 years ago

Hi @hrjn ,

The JDK 1.8 docs is a bit old. I added that when we initially upgraded to the CDK 1.5.12 which introduced the new depict API. At the time i erroneously thought that Java 1.8 is needed. We later reverted to the use of 1.7.

However, the bug Unsupported major.minor version 52.0, is probably due to teh new rCDK JARs being compiles with Java 8 and are causing backwards-incompatible errors when using a lower JDK. Can you check if upgrading to Java 8 solves your problem? Perhaps requiring Java8 is the way to go.

zach cp

hrjn commented 6 years ago

@zachcp Thanks for your quick reply, so the following error: Error in .jcall(\"org/guha/rcdk/descriptors/DescriptorUtilities\", \"[Ljava/lang/String;\", : RcallMethod: cannot determine object class\n" would not be linked to JDK version. I saw that rJava could also be a point of failure, so I uninstalled rcdk and rcdklibs, and re-installed rJava from source (not via CRAN). I still get the same error. Any pointers to what would be the cause?

Java JDK 1.7 R version 3.3.1 rJava version 0.9.8 rcdk version 3.4.3 rcdklibs version 2.0

rajarshi commented 6 years ago

Is this still an issue? What is the output of

library("rJava")
.jinit()
.jcall("java/lang/System", "S", "getProperty", "java.runtime.version")

Does it match the version of Java reported if you run from the command line?

$ java -version

FWIW, https://github.com/MTFA/CohortEx/wiki/Run-rJava-with-RStudio-under-OSX-10.10,-10.11-(El-Capitan)-or-10.12-(Sierra) got my issues resolved on OS X (Sierra) and R 3.3.2