.jinit initializes the Java Virtual Machine (JVM). This
function must be called before any rJava functions can be used..jinit(classpath = NULL, parameters = getOption("java.parameters"), ...,
silent = FALSE, force.init = FALSE)CLASSPATH environment
variable. Do NOT set this system class path initializinTRUE no warnings are issued.TRUE JVM is re-initialized even if
it is already running..jinit, but
call .jpackage instead. In addition this allows the use
of class path modifying function .jaddClassPath. Important note: if a class is found on the system class path (i.e. on
the classpath specified to .jinit) then the system class
loader is used instead of the rJava loader, which can lead to problems
with reflection and native library support is not enabled. Therefore
it is highly recommended to use .jpackage or
.jaddClassPath instead of classpath (save for system
classes).
Stating with version 0.3-8 rJava is now capable of modifying the class
path on the fly for certain Sun-based Java virtual machines, even when
attaching to an existing VM. However, this is done by exploiting the
way ClassLoader is implemented and may fail in the future. In general
it is officially not possible to change the class path of a running
VM.
At any rate, it is impossible to change any other VM parameters of a
running VM, so when using .jinit in a package, be generous with
limits and don't use VM parameters to unnecessarily restrict
resources (or preferably use .jpackage instead).
.jpackage## set heap size limit to 512MB (see java -X) and
## use "myClasses.jar" as the class path
.jinit(classpath="myClasses.jar", parameters="-Xmx512m")Run the code above in your browser using DataLab