1

I am building a large species distribution model using the package "dismo" in the latest version of r. When I go to process the basic model using the code:

me <- maxent(x=train, p=p)

I get the following error:

> Error in .jcall(mxe, "S", "fit", c("autorun", "-e", afn, "-o", dirout,
> :    java.lang.OutOfMemoryError: unable to create new native thread

There is some discussion in stackoverflow and the internet about this error but none seem to address how to resolve the issue in the r code. Any input on this issue would be appreciated.

3
  • 1
    I don't know about r and rjava, so I'm not sure how tje JVM is beiong run, but it must be if Java is running. The JVM can take parameters telling it how much memory to use. So, that may be a clue for you to look. Commented Mar 14, 2013 at 2:39
  • 1
    I had similar errors and I had to increase allocated memory using > options(java.parameters = "-Xmx200m") Commented Apr 20, 2013 at 0:48
  • 1
    Worth noting that for the increase in memory to be effective it has to be done before the JVM in enabled: bramschoenmakers.nl/en/node/726 Commented Apr 24, 2013 at 4:05

1 Answer 1

2

from the dismo package: If you want to give MaxEnt (the Java virtual machine that runs it) more memory, you can do that by running something like this (for 1 GB) before you load the dismo library.

options(java.parameters = "-Xmx1g" )

Some people have reported problems when using this function on a Mac (Apple) computer. Specifically, the following error message occurs:

Error in .jcall(mxe, "S", "fit", c("autorun", "-e", afn, "-o", dirout, : java.lang.InternalError: Can’t start the AWT because
Java was started on the first thread. Make sure StartOnFirstThread is not specified in your application’s Info.plist or on the command line.

This is a known problem with certain Java applications on Macs. There are two work-arounds that we are aware of:

1) run Sys.setenv(NOAWT=TRUE) before running library rJava (this is what dismo does if rJava is not loaded). 2) use the JGR interface (a Java based R GUI). You can install JGR from here:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.