Closed benjamin658 closed 9 years ago
In short, for Java String: evaluating .jnew("java/lang/String","Hello")$toString()
will result in "Hello"
using rserve-client.
In short, for any Java object: In R you should call a Java method (that maybe uses javax.json APIs) that returns a string with JSON serialization of the value you want to get. Then in JavaScript it's easy to deserialize using JSON.parse()
.
Reason: Rserve is not sending actual object value to clients (i.e. rserve-client). At most what you can get from .jnew("java/lang/String","Hello")
is a class name java/lang/String
.
I just released version 0.3.3. Evaluating .jnew("java/lang/String","Hello")
will no longer result in an system error, but in a user error that describes what to do. You'll see that it suggests calling attributes(.jnew("java/lang/String","Hello"))
, in which case then you will get { jobj: [Error: Rserve does not know how to serialize type 22], jclass: 'java/lang/String', class: 'jobjRef' }
. So, again, use $toString()
or JSON serialization.
Hi...I have a new question
I'm trying to use this module to evaluate the command that provided by the rJava packages, which is the packages that can use java library in R script..
For example, I can use the script below to create a java String object..
and then I got the error : Error: type 48 is not implemented It seems that the module cannot handle the java object as the return value...
I have no idea how to fix it...can it just convert the rJava return value to string or something else?
Thanks a lot!