0

I have a clean install of RStudio Server (Pro) on clean Ubuntu 14.04. Install was smooth only problem I have is with rJava. Everything else appears to be working fine.

To install the rJava package I installed the package from the R (running as sudo) from the console. This is what I have always done when setting up RStudio Servers. Once installed rJava works fine from the R console as sudo or normal user.

From the RStudio IDE I can load the rJava package, but when I call .jinit() I get errors:

library(rJava)
.jinit()
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error in .jinit() : Cannot create Java virtual machine (-4)

This is contrary to what happens if I ssh onto the server directly as same user and run the same commands from R console - this does not generata any error.

Any idea what is going on here? I have searched around and not found anything that helps. I tried completely uninstalling openjdk, tried reinstalling the package. Nothing seems to work - and because I get different behavior between the R console on the terminal and the R console in RStudio Server I am slightly puzzled.

The version of R on the console is:

$platform
[1] "x86_64-pc-linux-gnu"

$arch
[1] "x86_64"

$os
[1] "linux-gnu"

$system
[1] "x86_64, linux-gnu"

$status
[1] ""

$major
[1] "3"

$minor
[1] "1.2"

$year
[1] "2014" 

$month
[1] "10"

$day
[1] "31"

$`svn rev`
[1] "66913"

$language
[1] "R"

$version.string
[1] "R version 3.1.2 (2014-10-31)"

$nickname
[1] "Pumpkin Helmet"

This is the same as the version that R Studio Server is using.

JAVA_HOME is the same from R console on terminal and R console in RStudio Server

> Sys.getenv('JAVA_HOME')
[1] "/usr/lib/jvm/java-1.7.0-openjdk-amd64/jre" 

This is the same as the JAVA_HOME I get from the shell.

I have the following java version:

java -version
java version "1.7.0_75"
OpenJDK Runtime Environment (IcedTea 2.5.4) (7u75-2.5.4-1~trusty1)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)

Would love some suggestions or input from folks who have struggled with this same problem.

Cheers, Matt

Matt Gardner
  • 76
  • 1
  • 7

1 Answers1

0

Have you check how much memory you set up for the JVM? I had the same issue as initially I set it up as 8g.

You can set up the size of JVM's memory using the following command: options( java.parameters = "-Xmx8g" )