#21689 closed defect (wontfix)
Extra arguments for /usr/bin/josm
| Reported by: | Crashillo | Owned by: | team |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Core | Version: | |
| Keywords: | Cc: |
Description
According to https://josm.openstreetmap.de/wiki/Help/Preferences#Settingacommondirectory you can set a different directory to handle the https://wiki.openstreetmap.org/wiki/Import/Guidelines#Use_a_dedicated_user_account with a single line:
java -Djosm.home=JOSM-imports -jar josm.jar
Since unix wraps all the java stuff with the /usr/bin/josm launcher, you may think that the following code should work, but:
$ josm -Djosm.home=JOSM-imports Using /usr/lib/jvm/java-11-openjdk-amd64/bin/java to execute josm. JOSM: unrecognized option '-Djosm.home'
I figured out that https://josm.openstreetmap.de/browser/josm/trunk/native/linux/tested/usr/bin/josm#L71 is the responsible for. But you can make it work just switching the "extra arguments" position like this:
- $JAVACMD $JAVA_OPTS -jar /usr/share/josm/josm.jar "$@" + $JAVACMD $JAVA_OPTS "$@" -jar /usr/share/josm/josm.jar
Is there any issue about switching the "$@" position that I'm missing? IMO, that would simplify the things a lot, keeping the java stuff wrapped.
Thanks in advance
Attachments (0)
Change History (3)
comment:1 by , 4 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
comment:2 by , 4 years ago
I achieved an easier solution which doesn't envolve any extra wrapper, based on the .desktop unix files:
Duplicate the file /usr/share/applications/org.openstreetmap.josm.desktop and modify only these fields as follows:
[Desktop Entry] ... Name=JOSM Imports Exec=env JAVA_OPTS="-Djosm.home=JOSM-imports" josm %U ...
Just simple as that 🎉
comment:3 by , 4 years ago
To make it work in the terminal you need this wrapper for /usr/bin/josm e.g. /usr/local/bin/josm-imports or $HOME/bin/josm-imports as @stoecker wrote.



Well. This change makes it impossible to pass any option to josm:
java --language=en -jar josm-custom.jarUnrecognized option: --language=en
If you want to add custom java arguments I suggest to use another wrapper, e.g. stored in your $HOME/bin dir.