View source: R/j4rConnection.R
connectToJava | R Documentation |
This function connects the R environment to a gateway server that runs in Java.
connectToJava(
host = "localhost",
ports = c(0, 0),
extensionPath = NULL,
memorySize = NULL,
public = FALSE,
internalPorts = c(0, 0),
key = NULL,
headless = T
)
host |
the URL or IP address of the host ("localhost" by default ) |
ports |
a vector of the listening ports for the Java server |
extensionPath |
a vector of characters that contains the paths to jar files or to the classes that are to be loaded by the system classloader. |
memorySize |
the memory size of the Java Virtual Machine in Mb (if not specified, the JVM runs with the default memory size) |
public |
true to connect to a server that is already running locally (FALSE by default) |
internalPorts |
a vector of two integers representing the backdoor port and the garbage collector port |
key |
an integer used as a token to ensure a secure connection |
headless |
a boolean to enable the headless mode (is true by default). |
The first argument of the function provides the listening ports for the Java server. A maximum of four ports is allowed. When set to 0, these ports are randomly selected. By default, the server listens to two random ports.
The extensionPath can either be set in this function or dynamically changed (see the addToClassPath function). However, dynamic classpath changes are not allowed in Java version later than 16.
The headless mode assumes the JVM has no keyboard, display or mouse. In order to enable the UI on the Java end, the headless argument should be set to false.
a logical TRUE if the function managed to get connected to the server or if it was already connected or FALSE if the connection has failed
addToClassPath
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.