Closed yunmika closed 8 months ago
Yes, they can as long as the Java objects you save support serialization.
Example:
> library(rJava)
> .jinit()
> (s = .jnew("java.lang.String", "hello!"))
[1] "Java-Object{hello!}"
> .jcache(s)
> saveRDS(s, "java.rds")
(new session)
> library(rJava)
> .jinit()
> (s = readRDS("java.rds"))
[1] "Java-Object{hello!}"
> s$toString()
[1] "hello!"
>
If you have issues, you'll have to elaborate on the exact Java and R code you are using to create, save and restore the state.
Thanks for your reply, the issue has been successfully resolved.
Hi, I attempted to save objects generated by rJava using saveRDS to my local machine. However, upon attempting to re-read them using readRDS, I found that the objects were corrupted. Are there alternative methods to avoid this issue?