connectToJava: Connect to Java environment

View source: R/j4rConnection.R

connectToJavaR Documentation

Connect to Java environment

Description

This function connects the R environment to a gateway server that runs in Java.

Usage

connectToJava(
  host = "localhost",
  ports = c(0, 0),
  extensionPath = NULL,
  memorySize = NULL,
  public = FALSE,
  internalPorts = c(0, 0),
  key = NULL,
  headless = T
)

Arguments

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).

Details

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.

Value

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

See Also

addToClassPath


CWFC-CCFB/J4R documentation built on Oct. 30, 2024, 4:20 p.m.