LD_LIBRARY_PATH
set correctly.
Source one of the RJava.csh
or RJava.bash
scripts
that are created during the configuration of the R-Java package.
To find them, run the R command
system.file("scripts/RJava.csh", pkg="Java")The first is for use within C shells (csh and tcsh) and the latter for use with the Bourne shell (sh, bash). This must be done before starting R.
These scripts append the appropriate directories to one's
LD_LIBRARY_PATH
variable and makes .
the Java libraries and support library in the R package
for Java available to the dynamic loader.
.JavaInit()
, the prompt never
returns. Any solution?
local
.
That is
dyn.load("Java.so", local=FALSE)The automatic configuration attempts to get this correct and put the appropriate call in
.First.lib
.
dyn.load()
is called. Make certain that
the Java.so
shared library is loaded
with the argument local=FALSE
.
RForeignReference
, Java
complains about not being able to load a library named
Java.so
and prints a huge call-stack trace.
LD_LIBRARY_PATH
variable correctly.Java/libs
directory that connects Java.so expected by R
to libJava.so
expected by the Java virtual
machine.
In other words, this issues the command
ln -s Java.so libJava.soin the
Java/libs
directory.
A script - cleanup
-
will do this for you. It is located in the
Java/scripts
directory where the library was installed.
.Java()
or
.JavaConstructor
so slow?
This lengthy class list construction can be reduced (or
eliminated).
Firstly, use fully-qualified class names.
This makes the code more readable, but it is tedious.
An alternative is to tell Omegahat which classpath elements
for which it should construct the class lists.
This list is specified via the JVM property
OmegahatClassLists
javaConfig(OmegahatClassLists="./myclasses:/home/me/Java/classes.jar")See The Omegahat Howto.
.Java
call couldn't resolve a
real Java method, but got one that had the same name and number
of arguments. One of the most common causes for this in R
is when one specifies an integer constant (e.g. 0) but it is
passed to Java as a double/numeric. For example
v <- .JavaConstructor("util.Vector", 3)The three here is actually of more numeric.
This behaviour is part of R and S3 and unfortunately we are stuck with it. (A lot of the R code (especially Fortran associated) breaks if this is changed. It does not happen in S4.)