jpackage(rJava)
jpackage()所属R语言包:rJava
Initialize an R package containing Java code
R包,其中包含Java代码初始化
译者:生物统计家园网 机器人LoveR
描述----------Description----------
.jpackage initializes the Java Virtual Machine (JVM) for an R package. In addition to starting the JVM it also registers Java classes and native code contained in the package with the JVM. function must be called before any rJava functions can be used.
.jpackageR包的初始化Java虚拟机(JVM)。除了启动JVM也注册Java类和本地代码包的JVM中。函数必须被调用之前,可用于任何rJava功能。
用法----------Usage----------
.jpackage(name, jars='*', morePaths='', nativeLibrary=FALSE, lib.loc=NULL)
参数----------Arguments----------
参数:name
name of the package. It should correspond to the pkgname parameter of .onLoad or .First.lib function.
包的名称。它应该对应的pkgname.onLoad或.First.lib函数的参数。
参数:jars
Java archives in the java directory of the package that should be added to the class path. The paths must be relative to package's java directory. A special value of '*' adds all .jar files form the java the directory.
Java归档java应该被添加到类路径中的包的目录。路径必须是相对于包的java目录。一个特殊值'*'添加了所有的.jar文件形成java目录。
参数:morePaths
vector listing any additional entries that should be added to the class path.
向量列出任何应该被添加到类路径中的其他条目。
参数:nativeLibrary
a logical determining whether rJava should look for native code in the R package's shared object or not.
一个逻辑决定是否rJava应为本地代码在R包的共享对象或不看。
参数:lib.loc
a character vector with path names of R libraries, or NULL (see system.file and examples below).
特征向量与研发库的路径名,或NULL(见system.file下面的例子)。
Details
详情----------Details----------
.jpackage initializes a Java R package as follows: first the JVM is initialized via .jinit (if it is not running already). Then the java directory of the package is added to the class path. Then .jpackage prepends jars with the path to the java directory of the package and adds them to the class path (or all .jar files if '*' was specified). Finally the morePaths parameter (if set) is passed to a call to .jaddClassPath.
.jpackage初始化一个Java R包如下:首先在JVM通过初始化.jinit(如果它尚未运行)。然后java包的目录添加到类路径。然后.jpackage预先jarsjava包目录的路径,并将它们添加到类路径(或所有.jar文件'*'指定)。最后,通过一个调用morePaths的.jaddClassPath参数(如果设置)。
Therefore the easiest way to create a Java package is to add .jpackage(pkgname, lib.loc=libname) in .onLoad or .First.lib, and copy all necessary classes to a JAR file(s) which is placed in the inst/java/ directory of the source package.
创建一个Java包,因此,最简单的方法是添加.jpackage(pkgname, lib.loc=libname).onLoad或.First.lib,所有必要的类复制到一个JAR文件(S),它被放置在<X >目录的源代码包。
If a package needs special Java parameters, "java.parameters" option can be used to set them on initialization. Note, however, that Java parameters can only be used during JVM initialization and other package may have intialized JVM already.
如果一个包需要特殊的Java参数,"java.parameters"选项可以用来设置初始化。但是请注意,只能在JVM初始化和其他包使用Java参数可能intialized的JVM已经。
值----------Value----------
The return value is an invisible TRUE if the initialization was successful.
如果初始化成功,返回值是一种无形的真。
参见----------See Also----------
.jinit
.jinit
举例----------Examples----------
## Not run: [#无法运行:]
.onLoad <- function(libname, pkgname) {
.jpackage(pkgname, lib.loc=libname)
}
## End(Not run)[#结束(不运行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|