Error in rJava::.jcall(mxe, "S", "meversion") when running maxent with 'dismo'

451 views
Skip to first unread message

Marie-lyne Després-Einspenner

unread,
Sep 21, 2017, 10:36:42 PM9/21/17
to Maxent
Hello everyone,

When trying to fit my MaxEnt model in R using the dismo package, I get the following error:

Error in rJava::.jcall(mxe, "S", "meversion") :
  java
.lang.UnsupportedClassVersionError: density/Utils : Unsupported major.minor version 52.0
Error in .getMeVersion() :
 
"dismo" needs a more recent version of Maxent (3.3.3b or later)
Please download it here: http://www.cs.princeton.edu/~schapire/maxent/
       
 
and put it in this folder:
/Library/Frameworks/R.framework/Versions/3.3/Resources/library/dismo/java



However, I downloaded the most recent versions of MaxEnt and Java.

my code:
options(java.parameters = "-Xmx1g")
library
(raster)
library
(dismo)
maxent_bg_naive
<-maxent(pres_bg[, c("Distance_to_PA", "Distance_to_rivers", "Hansen_last_Guinea",
                                   
"Mean_annual_precipitation", "Mean_annual_temperature",
                                   
"Mean_elevation", "Mean_slope", "NDVI_Guinea",
                                   
"Rain_seasonality", "VIIRS")],
                        pres_bg
[,"presence"])

Joshua Havill

unread,
Oct 7, 2017, 5:17:55 PM10/7/17
to Maxent
Hello Marie,

I also recently received such errors in the process of attempting to generate MaxEnt models in R.  I haven't identified a solution but I am interested to hear if others have found a workaround or can provide a solution to the issue you've encountered.

Cheers,
Josh

Chandra Salgado

unread,
Jun 3, 2018, 2:05:30 PM6/3/18
to Maxent
Hello all,

I also am running into the same problems. I have ensured I have done the following:

1) checked my platform on my PC (running Windows 10) with the following:

devtools::session_info()$platform

>setting  value                       
>version  R version 3.4.1 (2017-06-30)
>system   x86_64, mingw32             
>ui       RStudio (1.1.419)           
>language (EN)                        
>collate  English_Australia.1252      
>tz       Australia/Perth             
>date     2018-05-30 double checked that t

2) ensured that java, R, RStudio are all 64-bit. 
2) That rjava knows where to read java from by using: Sys.setenv(JAVA_HOME='C:\\Program Files\\Java\\jre7')
3) Ensured that the four Maxent files (maxent Windows Batch File, maxent Executable Jar File, maxent.sh, and the read me file) were in the correct folder: C:\Users\CS\Documents\R\win-library\3.4\dismo\java. These were downloaded on the 30 May 2018 so are the most current versions (date of this email).
3) then I loaded rjava and dismo within R
4) and running maxent() gives the same error. 

I have searched the internet for ideas, and am at a loss as to how to fix this!. 

Any insight will be hugely appreciated! Many thanks in advance!! 

Chandra

nguy...@unlv.nevada.edu

unread,
Feb 13, 2019, 7:30:38 PM2/13/19
to Maxent
Hi everyone,

Was anyone able to correct this issue? I am running MaxEnt 3.4.1, and getting this issue.

Best

Cass Kalinski

unread,
Feb 13, 2019, 11:08:25 PM2/13/19
to Maxent
Chandra,
May be system specific, but when I checked my WIN10 machine, my Java path is C:\Program Files\Java\jre1.8.0_201\bin. Your Sys.setenv() has something different. 

Oracle has been thrashing around a bit with paths the last year or so though.

Cass

Ahmed El-Gabbas

unread,
Apr 18, 2019, 11:20:08 AM4/18/19
to Maxent
Hello,

Having this code BEFORE loading the rJava (and hence dismo) worked for me:

Sys.setenv(NOAWT=TRUE)

Cheers,
Ahmed

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dr. Ahmed El-Gabbas,
Ocean Acoustics Lab, Alfred-Wegener-Institut
Helmholtz-Zentrum für Polar und Meeresforschung
Website: https://elgabbas.github.io/

Gabriel Martin

unread,
Aug 12, 2019, 10:13:15 AM8/12/19
to Maxent
Hi Ahmed, did you paste 
Sys.setenv(NOAWT=TRUE) 
in the script after this initial part:
#Run only the first time
  #install.packages(c("raster", "dismo", "pbapply",
  # "rgeos", "dplyr", "rgdal",
  # "maptools", "ENMeval" , "here",
  # "adehabitatHR")) #only run if frist time or need update pckgs

java parameters start after this.
Thanks,
Gabriel
Reply all
Reply to author
Forward
0 new messages