\name{jdynamicCompile} \alias{jdynamicCompile} \title{Dynamically Compile a Java Class} \description{ This uses the dynamic byte-code generator facility in Omegahat to create a new Java class with a given name. By default, the new class extends the \code{RForeignReference} class and implements a specifiable collection of Java interfaces. Each method in these interfaces is implemented by calling the corresponding R function in the R reference object. } \usage{ jdynamicCompile(interface, newClass, generatorClass="ForeignReferenceClassGenerator", load=TRUE) } \arguments{ \item{interface}{the (fully qualified) name of one or more Java interface classes that the new class should implement. The methods in these interfaces are implemented as calls to the correspondingly named R function in the R object identified by the \code{RForeignReference}'s key. } \item{newClass}{the name of the new class to be created.} \item{generatorClass}{the name of the Java class to which is to be used as the dynamic compiler. This is rarely specified, but allows one to use classes that implement the code differently, e.g. by extending \code{ForeignReferenceClassGenerator}.} \item{load}{logical value indicating whether the new class should be loaded into the Omegahat list of available classes. If this is \code{FALSE}, one usually writes the newly generated class definition to a file.} } \references{\url{http://www.omegahat.org}} \author{Duncan Temple Lang} \examples{ \dontrun{ jdynamicCompile("java.awt.event.ActionListener", "RActionListener") l <- .JNew("RActionListener", foreignReference(list(actionPerformed=function() print("ok")))) button$add(l) } \dontrun{ def <- jdynamicCompile("java.awt.event.ActionListener", "RActionListener", load=F) def$write() } } \keyword{programming} \keyword{interface}