wiki:Help/CommandLineOptions

Version 25 (modified by Hb---, 7 years ago) ( diff )

Complete review after ticket:15894, Smaller list of arguments and examples to fit in 90 chars width

Command Line Options

JOSM is affected by three groups of command line options. The Program arguments are most important and than the Java options. Only involved in Web Start are the run-options. See Examples

# Running a jar
java [Java options] -jar josm-tested.jar [Program arguments]

# Launch a Web Start
javaws [run-options] -J[Java option] josm.jnlp

Program arguments

Also called Post jar arguments here or args by Oracle.

The first argument is seen as command by JOSM. The possible commands are runjosm for normal launch (default), render for generating an image file and project converting coordinates. If JOSM can't recognize a command the default is assumed.

The following arguments are options for JOSM. They are separated by spaces. They can be URLs, filenames, coordinates, simple options and option=argument pairs. The complete list of commands and options is shown below:

usage:
  java <java options> -jar josm.jar [<command>] <options>

commands:
  runjosm     launch JOSM (default, performed when no command is specified)
  render      render data and save the result to an image file
  project     convert coordinates from one coordinate reference system to another

For details on the render and project commands, run them with the --help option.
The remainder of this help page documents the runjosm command.

options:
  --help|-h                                 Show this help
  --geometry=widthxheight(+|-)x(+|-)y       Standard unix geometry argument
  [--download=]minlat,minlon,maxlat,maxlon  Download the bounding box
  [--download=]<URL>                        Download the location URL which has
                                            coordinates like lat=x&lon=y&zoom=z
  [--download=]<filename>                   Open a file (same as Menu/File/Open)
  --downloadgps=minlat,minlon,maxlat,maxlon Download the bounding box as raw GPS
  --downloadgps=<URL>                       Download the location as raw GPS
  --selection=<searchstring>                Select with the given search
  --[no-]maximize                           Launch in maximized mode
  --reset-preferences                       Reset the preferences to default
  --load-preferences=<url-to-xml>           Import preferences from XML file
  --set=<key>=<value>                       Set preference key to value
  --language=<language>                     Set the language
  --version                                 Displays the JOSM version and exits
  --debug                                   Print debugging messages to console
  --skip-plugins                            Skip loading plugins
  --offline=[osm_api,][josm_website,][all]  Disable access to the listed resources

The --download= part of the download option is optional. The arguments --download, --downloadgps and --selection are processed in this order. The value <url-to-xml> can point to a local file with file:relative/path/name.xml. The items in the --offline value are separated by comma.

Java options

The Java options are also called JOSM JVM options here or VM arguments in the Status Report. In that report you can see them and also the Program Arguments. They control the Java virtual machine (JVM) and can set properties inside it. JOSM reads some of them, for example josm.home and user.language.

java options:
  -Djosm.dir.name=JOSM                      Change the JOSM directory name
  -Djosm.pref=/PATH/TO/JOSM/PREF            Set the preferences directory
                                            Default: C:\Users\name\AppData\Roaming\JOSM
  -Djosm.userdata=/PATH/TO/JOSM/USERDATA    Set the user data directory
                                            Default: /home/name/.local/share/JOSM
  -Djosm.cache=/PATH/TO/JOSM/CACHE          Set the cache directory
                                            Default: <...>
  -Djosm.home=/PATH/TO/JOSM/HOMEDIR         Set the common directory for preferences,
                                            user data and ./cache/. Lower precedence.
                                            Will get overridden from specific setting.
  -Xmx...m                                  Set maximum Java heap size in megabytes.
                                            May avoid Out-of-Memory errors.

The -Xmx...m option may be useful when Out of Memory errors arise. If you set a common directory with Djosm.home then JOSM will create the subdirectories ./autosave, ./cache and ./validator. If a value has spaces, then enclose it in quotation marks like "josm dev".

run-options

The run-options follow the javaws command. They control the Web Start mechanism and the environment for the JVM.

  -offline                  Allows to Web Start JOSM without internet access
  -J<java option>           Supplies the <java option> to the JVM 
  -J-Xmx1024m               Here: Set maximum Java heap size to 1024 megabyte

The -J run-option takes its part behind the J letter and supplies that as Java option. The jnlp-File used by Web Start offers a second way to set options for JRE and for the JOSM program directly.

Examples

# Load three files
  java -jar josm.jar track1.gpx BigBen.jpg "london data.osm"
# Download from OSM according to an URL with zoom and coordinates
  java -jar josm.jar https://www.openstreetmap.org/#map=19/51.51/-0.135
# Download a bounding box and select every element matching a string
  java -jar josm.jar 51.505,-0.14,51.515,-0.13 --selection="Piccadilly Circus"
#
# Set directory for JOSM according to a property from the operating system
  java -Djosm.pref=$XDG_CONFIG_HOME jar josm.jar
# Quotations for a value with space
  java -Djosm.dir.name="josm dev" -jar josm.jar
# Set the common directory in a sub-subdirectroy below the active command prompt
  java -Djosm.home=biketour2017/london -jar josm.jar
# More memory in a French spoken environment
  java -Xmx1024m -Duser.language=fr -jar josm.jar
#
# Log everything in English
  java -verbose  -jar josm-latest.jar --language=en --debug >WhatsUp.txt

See also

Note: See TracWiki for help on using the wiki.