jnew

0th

Percentile

Create a Java object

.jnew create a new Java object

Keywords
interface
Usage
.jnew(class, ..., check=TRUE, silent=!check)
Arguments
class
fully qualified class name in JNI notation (e.g. "java/lang/String").
...
Any parametes that will be passed to the corresponding constructor. The parameter types are determined automatically and/or taken from the jobjRef object. For details see .jcall. Not
check
If set to TRUE then .jcheck is invoked before and after the call to the constructor to clear any pending Java exceptions.
silent
If set to FALSE then .jnew will fail with an error if the object cannot be created, otherwise a null-reference is returned instead. In addition, this flag is also passed to final .jcheck if check
Value

  • Returns the reference (jobjRef) to the newly created object or null-reference (see .jnull) if something went wrong.

See Also

.jcall, .jnull

Aliases
  • .jnew
Examples
f <- .jnew("java/awt/Frame","Hello")
.jcall(f,,"setVisible",TRUE)
Documentation reproduced from package rJava, version 0.4-14, License: GPL version 2

Community examples

Looks like there are no examples yet.