jinit(rJava)
jinit()所属R语言包:rJava
Initialize Java VM
初始化Java虚拟机
译者:生物统计家园网 机器人LoveR
描述----------Description----------
.jinit initializes the Java Virtual Machine (JVM). This function must be called before any rJava functions can be used.
.jinit初始化Java虚拟机(JVM)。这个函数必须被调用之前,可用于任何rJava功能。
用法----------Usage----------
.jinit(classpath = NULL, parameters = getOption("java.parameters"), ...,
silent = FALSE, force.init = FALSE)
参数----------Arguments----------
参数:classpath
Any additional classes to include in the Java class paths (i.e. locations of Java classes to use). This path will be prepended to paths specified in the CLASSPATH environment variable. Do NOT set this system class path initializing a package, use .jpackage instead, see details.
任何额外的类,在Java类路径(即Java类的位置使用)。这条道路将前面的CLASSPATH环境变量指定的路径。不要设置此系统初始化包的类路径,使用.jpackage相反,看到的细节。
参数:parameters
character vector of parameters to be passed to the virtual machine. They are implementation dependent and apply to JDK version 1.2 or higher only. Please note that each parameter must be in a separate element of the array, you cannot use a space-separated string with multiple parameters.
要传递给虚拟机的特征参数向量。他们是依赖于实现,并适用于JDK 1.2版或更高版本。请注意,每个参数必须是在一个单独的数组元素,你可以不使用多个参数用空格分隔的字符串。
参数:...
Other optional Java initialization parameters (implementation-dependent).
其他可选的Java初始化参数(依赖于实现)。
参数:silent
If set to TRUE no warnings are issued.
如果设置为TRUE没有发出警告。
参数:force.init
If set to TRUE JVM is re-initialized even if it is already running.
如果设置TRUEJVM的重新初始化,即使它已在运行。
Details
详情----------Details----------
Starting with version 0.5 rJava provides a custom class laoder that can automatically track classes and native libraries that are provided in R packages. Therefore R packages should NOT use .jinit, but call .jpackage instead. In addition this allows the use of class path modifying function .jaddClassPath.
与rJava 0.5版本开始提供了一个定制类laoder的,可以自动跟踪在R包提供的类和本地库。因此,R包不应该使用.jinit,但打电话.jpackage代替。此外,这使得使用类路径的修改功能.jaddClassPath。
Important note: if a class is found on the system class path (i.e. on the classpath specified to .jinit) then the system class loader is used instead of the rJava loader, which can lead to problems with reflection and native library support is not enabled. Therefore it is highly recommended to use .jpackage or .jaddClassPath instead of classpath (save for system classes).
重要说明:如果一个类被发现的系统类路径(即在classpath指定.jinit),那么系统类加载器,而不是rJava装载机,这可能会导致与反思的问题支持本地库未启用。因此,强烈建议使用.jpackage或.jaddClassPath而不是classpath(保存系统类)。
Stating with version 0.3-8 rJava is now capable of modifying the class path on the fly for certain Sun-based Java virtual machines, even when attaching to an existing VM. However, this is done by exploiting the way ClassLoader is implemented and may fail in the future. In general it is officially not possible to change the class path of a running VM.
版本0.3-8 rJava说明现在能够修改某些基于Sun的Java虚拟机动态类路径,即使附加到现有的虚拟机。然而,这是通过利用方式的ClassLoader实现,并可能在未来失败。一般来说,它是正式不可能改变运行中的VM类路径。
At any rate, it is impossible to change any other VM parameters of a running VM, so when using .jinit in a package, be generous with limits and don't use VM parameters to unnecessarily restrict resources (or preferably use .jpackage instead).
无论如何,这是不可能改变任何其他运行中的VM虚拟机的参数,所以,当使用.jinit在一个包,是慷慨与限制,并没有使用VM参数不必要的限制资源(或者最好使用 .jpackage代替)。
值----------Value----------
The return value is an integer specifying whether and how the VM was initialized. Negative values indicate failure, zero denotes successful initialization and positive values signify partially successful initilization (i.e. the VM is up, but parameters or class path could not be set due to an existing or incompatible VM).
返回值是一个整数,指定是否以及如何在VM初始化。负值表示失败,零表示初始化成功和正面的价值观表示部分成功initilization(即虚拟机,但由于现有的或不兼容的虚拟机,无法设置参数或类路径)。
参见----------See Also----------
.jpackage
.jpackage
举例----------Examples----------
## Not run: [#无法运行:]
## set heap size limit to 512MB (see java -X) and[#设置的堆大小限制为512MB(请参阅Java-X的)]
## use "myClasses.jar" as the class path[#使用类路径“myClasses.jar”的]
.jinit(classpath="myClasses.jar", parameters="-Xmx512m")
## End(Not run)[#结束(不运行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|