r.maxent.setup
Helper module to install Maxent to the addon directory
r.maxent.setup [-ju] [maxent=name] [java=name] [--verbose] [--quiet] [--qq] [--ui]
Example:
r.maxent.setup maxent=name
grass.script.run_command("r.maxent.setup", maxent=None, java=None, flags=None, verbose=False, quiet=False, superquiet=False)
Example:
gs.run_command("r.maxent.setup", maxent="name")
Parameters
maxent=name
Location Maxent jar file
Give the path to the Maxent executable file (maxent.jar)
java=name
Location Jave executable
Give the path to the Java executable file.
-j
Check if Java can be found on the system
Check if Java can be found from the GRASS GIS command line.
-u
Overwrites maxent.jar in addon directory
If the Maxent executable already exists in the addon directory, it will be overwritten.
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--qq
Very quiet module output
--ui
Force launching GUI dialog
maxent : str, optional
Location Maxent jar file
Give the path to the Maxent executable file (maxent.jar)
Used as: input, file, name
java : str, optional
Location Jave executable
Give the path to the Java executable file.
Used as: input, file, name
flags : str, optional
Allowed values: j, u
j
Check if Java can be found on the system
Check if Java can be found from the GRASS GIS command line.
u
Overwrites maxent.jar in addon directory
If the Maxent executable already exists in the addon directory, it will be overwritten.
verbose: bool, optional
Verbose module output
Default: False
quiet: bool, optional
Quiet module output
Default: False
superquiet: bool, optional
Very quiet module output
Default: False
DESCRIPTION
The r.maxent.setup addon provides a helper function to install Maxent and ensures that GRASS GIS can locate the Java executable, a prerequisite for running Maxent.
Maxent
The r.maxent.train and r.maxent.predict modules require the Maxent software, which can be downloaded from the Maxent website. The r.maxent.setup installs this to the GRASS GIS addon directory. If you want to update the Maxent.jar file, use the -u flag.
Java
Maxent requires Java to be installed, and it should be accessible from the GRASS GIS environment. You can check this by running the r.maxent.setup with the -j flag.
On Windows, even if JAVA is installed and on the PATH, GRASS GIS may still not be able to find it. The reason is that OSGeo4W environment used by GRASS GIS on Windows has its own shell environment, which may not automatically inherit the system-wide PATH or environment variables from Windows. As a result, even if Java is correctly installed and accessible from a regular Command Prompt or PowerShell, it might not be visible to GRASS GIS within the OSGeo4W shell.
To enable GRASS GIS to find the path to the Java executable, you can set the path to the executable using the java parameter. The path will be written to a text file in the GRASS GIS addon directory, which can be used by the r.maxent.train and r.maxent.predict modules.
An arguably better but more involved way is to add the Java directory to the OSGeo4W PATH. See the NOTES for a short 'how to'.
NOTES
Instead of using this addon to set the path to the java executable, you can add the Java directory to the OSGeo4W PATH temporarily. Open the Open the OSGeo4W shell and run the following:
set PATH=C:\Program Files\Java\jdk-XX.X.X\bin;%PATH%
Replace C:\Program Files\Java\jdk-XX.X.X\bin with your Java installation path. To make this change persistent, you need to edit the osgeo4w.bat file. This file can be found in the OSGeo4W installation folder. Locate the file, and find the line that starts with set PATH=.
At the end of that line, add a semi-colun and the path to the Java installation path. For example:
set PATH=%PATH%;C:\Program Files\Java\jdk-XX.X.X\bin;
Replace C:\Program Files\Java\jdk-XX.X.X\bin with your Java installation path. Save the file and restart the OSGeo4W shell. Note that you may need administrator rightrs to edit the osgeo4w.bat file.
SEE ALSO
AUTHOR
Paulo van Breugel, HAS green academy, Innovative Biomonitoring research group, Climate-robust Landscapes research group
SOURCE CODE
Available at: r.maxent.setup source code
(history)
Latest change: Friday Feb 21 10:10:05 2025 in commit 7d78fe3