Changeset 6234 in josm


Ignore:
Timestamp:
2013-09-18T23:02:11+02:00 (11 years ago)
Author:
Don-vip
Message:

fix #9077 - Restart doesn't work if jar path contains spaces

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/RestartAction.java

    r6125 r6234  
    9191            // program main and program arguments (be careful a sun property. might not be supported by all JVM)
    9292            String[] mainCommand = System.getProperty("sun.java.command").split(" ");
     93            // look for a .jar in all chunks to support paths with spaces (fix #9077)
     94            String jarPath = mainCommand[0];
     95            for (int i = 1; i < mainCommand.length && !jarPath.endsWith(".jar"); i++) {
     96                jarPath += " " + mainCommand[i];
     97            }
    9398            // program main is a jar
    94             if (mainCommand[0].endsWith(".jar")) {
     99            if (jarPath.endsWith(".jar")) {
    95100                // if it's a jar, add -jar mainJar
    96101                cmd.add("-jar");
    97                 cmd.add(new File(mainCommand[0]).getPath());
     102                cmd.add(new File(jarPath).getPath());
    98103            } else {
    99104                // else it's a .class, add the classpath and mainClass
Note: See TracChangeset for help on using the changeset viewer.