UnsatisfiedLinkError
and missing symbol
STRING_ELT
. What's going on?
--enable-R-shlibin the call to
configure
.
Then run make.
It is a good idea to issue the command
make distcleanbefore doing this. This removes any existing libraries which may not be recompiled to link against libR.so.
Rf_initEmbeddedR
, etc.
libR.so
)
and, on Unix, the bin/R_X11.so
(or similarly named library) to be linked against
this shared library.
scripts/RJava
which is is installed under the directory
in which the package is installed.
omegahat
shell
script, if it is installed.
scripts/RJava
, I get
a Java exception of the form
Exception in thread "main" java.lang.UnsatisfiedLinkError: nativeSetupWhat can I do?
LD_LIBRARY_PATH
(unsetenv LD_LIBRARY_PATH
in the C/TCSH shells,
and unset LD_LIBRARY_PATH
in Bash)
and try running the script again.
R
command
can be passed in the same way.
RJava --silent --gui=none --no-saveThe following list is edited from the output of the
R --help
command
to list the
--save | Do save data sets at the end of the session |
---|---|
--no-save | Don't save them |
--no-environ | Don't read the .Renviron or ~/.Renviron files |
--no-site-file | Don't read the site-wide Rprofile |
--no-init-file | Don't read the .Rprofile or ~/.Rprofile files |
--restore | Do restore previously saved data sets at startup |
--no-restore-data | Don't restore previously saved data sets |
--no-restore-history | Don't restore the R history file |
--no-restore | Don't restore anything |
--vanilla | Combine --no-save, --no-restore, --no-site-file, --no-init-file and --no-environ |
--no-readline | Don't use readline for command-line editing |
--vsize=N | Set vector heap size to N bytes; `4M' = 4 MegaB |
--nsize=N | Set number of cons cells to N |
-q, - | -quiet Don't print startup message |
--silent | Same as --quiet |
--slave | Make R run as quietly as possible |
--verbose | Print more information about progress |
-g, --gui=TYPE | Use TYPE as GUI; possible values are `X11' (default), `none' and `gnome' |
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.
.JavaInit()
)
before calling one of the functions that needed it.
Now when I call .JavaInit()
after this, it hangs?
.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. Additionally, the "production" versions (i.e. the non-development) versions we use typically load these class lists from a serialized object computed in an earlier session and this again reduces the startup time.
Xlib: unexpected async reply (sequence 0x1356)!
1: X11 protocol error: BadDrawable (invalid Pixmap or Window parameter) 2: X11 protocol error: BadDrawable (invalid Pixmap or Window parameter)What's happening?
There are two solutions:
.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 mode numeric, not integer.
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.)
Problem:
Trying the example for calling R from Java via
SJava/scripts/RJava --example --gui-none(in <RHOME>/library) throws an exception
Loading RInterpreter library Exception in thread "main" java.lang.UnsatisfiedLinkError: no RInterpreter in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1410) at java.lang.Runtime.loadLibrary0(Runtime.java:772) at java.lang.System.loadLibrary(System.java:832) at org.omegahat.R.Java.ROmegahatInterpreter.(or similiar; sometimes SJava instead of RInterpreter may be missing).(ROmegahatInterpreter.java:34) at org.omegahat.R.Java.Examples.JavaRPrompt.main(JavaRPrompt.java:17)
Rationale:
In <RHOME>/library/SJava/libs the symlinks from
libRInterpreter.so and libSJava.so to SJava.so
are missing, probably, because you did not install SJava using the
-c command switch.
Solution:
Reinstall SJava using the -c switch, i.e.
R CMD INSTALL -c SJava_0.62-6.tar.gzor create the symlinks by hand, switching to directory <RHOME>/library/SJava/libs and saying
ln -s SJava.so libRInterpreter.so ln -s SJava.so libSJava.so