Modify

Opened 8 years ago

Last modified 7 years ago

#7275 new enhancement

Allow restart plugin to restart via the CL

Reported by: rickmastfan67 Owned by: team
Priority: normal Milestone:
Component: Core restart Version: latest
Keywords: Cc:

Description

Is it possible to allow the restart plugin to restart JOSM via the CL in Windows?

I currently start JOSM with this command: "C:\Program Files\Java\jre6\bin\java.exe" -Xmx3072M -jar josm-tested.jar. If I were to attempt to use the restart plugin to restart JOSM, it then bypasses the original way that I started JOSM and directly loads the *.jar file for JOSM. Because of that, I don't get the Command Line Window that shows up telling me what JOSM has done and any conflicts (like with shortcuts) that happen.

Is there anyway that you might be able to change this behavior on Windows? I mean, if I started the *.jar file directly and then used the restart command, I would expect it just restart the jar file. But if I use the CL way, I expect the restart to be with the CL, not the jar directly.

Thanks.

Attachments (0)

Change History (10)

comment:1 in reply to:  description Changed 8 years ago by skyper

Replying to rickmastfan67:

Is it possible to allow the restart plugin to restart JOSM via the CL in Windows?

I currently start JOSM with this command: "C:\Program Files\Java\jre6\bin\java.exe" -Xmx3072M -jar josm-tested.jar. If I were to attempt to use the restart plugin to restart JOSM, it then bypasses the original way that I started JOSM and directly loads the *.jar file for JOSM. Because of that, I don't get the Command Line Window that shows up telling me what JOSM has done and any conflicts (like with shortcuts) that happen.

Is there anyway that you might be able to change this behavior on Windows? I mean, if I started the *.jar file directly and then used the restart command, I would expect it just restart the jar file. But if I use the CL way, I expect the restart to be with the CL, not the jar directly.

Only work around I see, is to add a script josm.exe in a path with higher priority. This script should start cmd and execute your starting command.

See also #5635 and #6344.

comment:2 Changed 7 years ago by Don-vip

Resolution: fixed
Status: newclosed

Fixed in r5857 with the integration of restart plugin into core.

comment:3 Changed 7 years ago by rickmastfan67

Resolution: fixed
Status: closedreopened

Yes and no to this being fixed.

While hitting the restart button keeps the "-Xmx3072M" command when restarting (which is great), the Command Prompt window doesn't survive the restart in Windows. Thus, if an error happens after the restart (like a "Registered toolbar action" error for an example), it will not be visible to a Windows user and can't be reported because they have no idea about it since the Command Prompt window is now gone.

comment:4 Changed 7 years ago by Don-vip

Owner: changed from Upliner to team
Status: reopenednew

Mmm you will probably have to add a script for that, as skyper suggested.

comment:5 in reply to:  4 Changed 7 years ago by skyper

Replying to Don-vip:

Mmm you will probably have to add a script for that, as skyper suggested.

Have the same problem with linux now and my solution won't work that well as instead of using the original command line (shell) a new one will open.

comment:6 Changed 7 years ago by skyper

Summary: Allow restart plugin to restart via the CL in WindowsAllow restart plugin to restart via the CL

adjusted summary as this is not windows specific.

comment:7 Changed 7 years ago by bastiK

We could modify the start script:

  • inside the script, start JOSM with a special command line option, e.g. java josm.jar --restart-possible
  • when restart is required,
    • if --restart-possible flag is set, simply exit with a special exit code
    • otherwise execute the current restart code normally
  • script checks the exit code and starts again as needed

minor disadvantage: the script will be running all the time and cannot exec cleanly.

comment:8 Changed 7 years ago by skyper

Is it not possible, to get the needed information ?

I doubt that the distribution maintainers will distribute it if it is not working properly.

comment:9 Changed 7 years ago by bastiK

In 6125/josm:

see #7275 - allow script to handle restart

When JOSM was started with parameter -Djosm.restart=true, a
user request for restart will simply terminate the application
with exit code 9.
The start script is then responsible for the restart.

comment:10 Changed 7 years ago by bastiK

Modifications to the script:

  • latest/usr/bin/josm-latest

     
    1616        JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-oracle/bin/java /usr/lib/jvm/java-6-sun/bin/java /usr/bin/java"
    1717fi
    1818
    19 JAVA_OPTS="-Djosm.home=$HOME/.josm-latest -Djava.net.useSystemProxies=true $JAVA_OPTS"
     19JAVA_OPTS="-Djosm.restart=true -Djosm.home=$HOME/.josm-latest -Djava.net.useSystemProxies=true $JAVA_OPTS"
    2020
    2121for jcmd in $JAVA_CMDS; do
    2222        if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
     
    3232
    3333if [ "$JAVACMD" ]; then
    3434    echo "Using $JAVACMD to execute josm-latest." || true
    35     exec $JAVACMD $JAVA_OPTS -jar /usr/share/josm-latest/josm-latest.jar "$@"
     35    set +e
     36    while true; do
     37        $JAVACMD $JAVA_OPTS -jar /usr/share/josm-latest/josm-latest.jar "$@"
     38        if [ "z$?" != "z9" ]; then
     39            break
     40        fi
     41        echo ">> restarting josm..."
     42    done
    3643else
    3744    echo "No valid JVM found to run JOSM." || true
    3845    exit 1
  • tested/usr/bin/josm

     
    1616        JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-oracle/bin/java /usr/lib/jvm/java-6-sun/bin/java /usr/bin/java"
    1717fi
    1818
    19 JAVA_OPTS="-Djava.net.useSystemProxies=true $JAVA_OPTS"
     19JAVA_OPTS="-Djosm.restart=true -Djava.net.useSystemProxies=true $JAVA_OPTS"
    2020
    2121for jcmd in $JAVA_CMDS; do
    2222        if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
     
    3232
    3333if [ "$JAVACMD" ]; then
    3434    echo "Using $JAVACMD to execute josm." || true
    35     exec $JAVACMD $JAVA_OPTS -jar /usr/share/josm/josm.jar "$@"
     35    set +e
     36    while true; do
     37        $JAVACMD $JAVA_OPTS -jar /usr/share/josm/josm.jar "$@"
     38        if [ "z$?" != "z9" ]; then
     39            break
     40        fi
     41        echo ">> restarting josm..."
     42    done
    3643else
    3744    echo "No valid JVM found to run JOSM." || true
    3845    exit 1

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to rickmastfan67
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket
The owner will be changed from team to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.