jinit                 package:rJava                 R Documentation

_I_n_i_t_i_a_l_i_z_e _J_a_v_a _V_M

_D_e_s_c_r_i_p_t_i_o_n:

     '.jinit' initializes the Java Virtual Machine (JVM). This function
     must be called before any rJava functions can be used.

_U_s_a_g_e:

     .jinit(classpath = NULL, parameters = getOption("java.parameters"), ...,
     silent = FALSE, force.init = FALSE)

_A_r_g_u_m_e_n_t_s:

classpath: Any additional classes to include in the Java class paths
          (i.e. locations of Java classes to use). This path will be
          prepended to paths specified in the 'CLASSPATH' environment
          variable. Do NOT set this system class path initializing a
          package, use '.jpackage' instead, see details.

parameters: character vector of parameters to be passed to the virtual
          machine. They are implementation dependent and apply to JDK
          version 1.2 or higher only. Please note that each parameter
          must be in a separate element of the array, you cannot use a
          space-separated string with multiple parameters.

     ...: Other optional Java initialization parameters
          (implementation-dependent).

  silent: If set to 'TRUE' no warnings are issued.

force.init: If set to 'TRUE' JVM is re-initialized even if it is
          already running.

_D_e_t_a_i_l_s:

     Starting with version 0.5 rJava provides a custom class laoder
     that can automatically track classes and native libraries that are
     provided in R packages. Therefore R packages should NOT use
     '.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).

_V_a_l_u_e:

     The return value is an integer specifying whether and how the VM
     was initialized. Negative values indicate failure, zero denotes
     successful initialization and positive values signify partially
     successful initilization (i.e. the VM is up, but parameters or
     class path could not be set due to an existing or incompatible
     VM).

_S_e_e _A_l_s_o:

     '.jpackage'

_E_x_a_m_p_l_e_s:

     ## Not run: 
     ## set heap size limit to 512MB (see java -X) and
     ## use "myClasses.jar" as the class path
     .jinit(classpath="myClasses.jar", parameters="-Xmx512m")
     ## End(Not run)

