Java调用R语言或S语言的接口,示例代码:
# This FALSE is important as otherwise we end up calling make twice, once in the constructor # and once here after we have specified the super class. gen <- .JavaConstructor("ForeignReferenceClassGenerator", "java.awt.event.ActionListener", "RActionListener", FALSE) .Java(gen, "superClassName", "org.omegahat.R.Java.RForeignReference") .Java(gen,"make") .Java(gen,"write", .JavaConstructor("File", "/tmp/RActionListener.class")) # Now load it, assuming /tmp/ is in your classpath. .Java(NULL, 'findClass', "RActionListener")