[R] Problem with rJava

ProfJCNash profjcnash at gmail.com
Fri Jan 15 01:24:51 CET 2016

Your post does not have the requested session information that will tell
us your computing environment, nor the version of R.

However, I'm experiencing at least a related problem, as this morning I
updated R (in Linux Mind Rafaela 17.2, so I get an operating system
notice to update via the package manager). Afterwards I ran
update.packages() but could not get rJava to carry out the update,
though other packages did complete. Possibly there is some mismatch
between rJava and R 3.2.3 and/or gcj. I'm a bit surprised this hasn't
surfaced before, as I'm a "slow updater" and 3.2.3 is over a month old now.

Below is the output from the update -- AFTER I ran "R CMD javareconf" as
root -- along with the session information, which shows Ubuntu rather
than the derivative Linux Mint.

Cheers, JN

> update.packages()
rJava :
 Version 0.9-6 installed in /usr/lib/R/site-library
 Version 0.9-8 available at https://rweb.crmda.ku.edu/cran
Update (y/N/c)?  y
trying URL 'https://rweb.crmda.ku.edu/cran/src/contrib/rJava_0.9-8.tar.gz'
Content type 'application/x-gzip' length 656615 bytes (641 KB)
downloaded 641 KB

* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/lib/jvm/default-java/jre/bin/java'
archiver    : '/usr/bin/jar'
compiler    : '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags   : ''
java libs   : '-L/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server
configure: error: One or more Java configuration variables are not set.
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.

If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.

ERROR: configuration failed for package ‘rJava’
* removing ‘/usr/lib/R/site-library/rJava’
* restoring previous ‘/usr/lib/R/site-library/rJava’

The downloaded source packages are in
Warning message:
In install.packages(update[instlib == l, "Package"], l, contriburl =
contriburl,  :
  installation of package ‘rJava’ had non-zero exit status
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS

 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8
 [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] tools_3.2.3 tcltk_3.2.3

On 16-01-14 05:45 PM, AASHISH JAIN wrote:
> Hello,
> I am using an R package called Rknots, which uses rJava (and others like rSymPy, rjson, rJython) and I am getting some error due to rJava. When I run my R code, the execution gets halted with the following error:
> Error in .jcheck() : No running JVM detected. Maybe .jinit() would help. (found this line in rjava.c)
> Calls: computeInvariant ... sympy -> $ -> $ -> hasField -> .jcall -> .jcheck -> .Call (this line comes from Rknots package when the function computeInvariant is called)
> Execution halted
> Note that since I could not install these packages on root level, I installed them locally on unix OS. Since the other Java and R software appears to be working, it seems like the error is specific to the rJava package. Possibly rJava makes some assumptions about the Java installation (perhaps its location) that cause it to be confused. I would like to know if a non-root Java installation would cause problems. 
> FYI, here are the versions of different packages that I currently have:
> 1. rSymPy_0.2-1.1.tar
> 2. rJava_0.9-8.tar
> 3. rjson_0.2.15.tar.gz
> 4. rJython_0.0-4.tar
> 5. Rknots_1.2.1.tar
> I would really appreciate any help. 
> I want to apologize if this forum is not a right place to discuss about rJava.
> Thanks!
> Aashish Jain
> Postdoctoral Associate
> Department of Chemical Engineering and Material Science
> 151 Amundson Hall
> 421 Washington Ave SE
> Minneapolis, MN 55455 USA
> Ph: +1 612-806-7154
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list