Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#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 stoecker, 3 years ago

Resolution: wontfix
Status: newclosed

Well. This change makes it impossible to pass any option to josm:

java --language=en -jar josm-custom.jar

Unrecognized 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.

Last edited 3 years ago by stoecker (previous) (diff)

comment:2 by Crashillo, 3 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 skyper, 3 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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.