isJavaInitialized: Determines whether the JVM has been created.

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

This determines whether the Java Virtual machine has already been initialized within this R session, usually via the .JavaInit This is useful when we want to use the Java interface, but want to avoid an error being thrown if the user hasn't already created Java.

Usage

1

Arguments

msg

A character string, which if specified and the virtual machine has not been initialized, is passed as the single argument in a call to stop.

Details

This checks the state of the internal C variables to determine if the user has initialized the JVM. It does not attempt to create the JVM. This allows the user to specify different arguments to customize the VM.

Value

A logical value indicating whether the JVM has been created earlier (TRUE) or not (FALSE). If the msg argument is specified and the JVM has not been initialized, an error is thrown and there is no return value.

Author(s)

Duncan Temple Lang

References

http://www.omegahat.org/RSJava

See Also

.JavaInit

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  isJavaInitialized("initialize Java with .JavaInit()")
  jlabel <- .JavaConstructor("javax.swing.JButton",
                             "Welcome the R-Java interface")
  f <- .JavaConstructor("org.omegahat.Environment.GUITools.GenericFrame", 
                        jlabel, TRUE)

    # optionally execute code.
 if(isJavaInitialized()) {
   .Java("System", "getProperty", "java.class.path")
 }

SJava documentation built on Oct. 5, 2016, 4:17 a.m.