Ignore:
Timestamp:
2012-06-16T23:05:53+02:00 (12 years ago)
Author:
upliner
Message:

'fix #j5635 -- pass java start options when restarting'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/restart/src/josmrestartplugin/RestartJosmAction.java

    r27852 r28438  
    66import java.awt.event.KeyEvent;
    77import java.io.File;
     8import java.lang.management.ManagementFactory;
     9import java.util.LinkedList;
    810
    911import org.openstreetmap.josm.Main;
     
    2830        try {
    2931            File jarfile = new File(Main.class.getProtectionDomain().getCodeSource().getLocation().toURI());
    30             long memmax = Runtime.getRuntime().maxMemory();
    3132            String javacmd = "java";
    3233            if (Main.platform instanceof PlatformHookWindows) javacmd = "javaw";
    33             String[] cmds = new String[] {
    34                     javacmd,
    35                     "-Xmx" + memmax,
    36                     "-jar",
    37                     jarfile.getAbsolutePath()
    38             };
     34            LinkedList<String> cmds = new LinkedList<String>();
     35            cmds.add(javacmd);
     36            cmds.addAll(ManagementFactory.getRuntimeMXBean().getInputArguments());
     37            cmds.add("-jar");
     38            cmds.add(jarfile.getAbsolutePath());
    3939            for (String s : cmds)
    4040                System.out.print(s + " ");
    4141            System.out.println();
    4242
    43             Runtime.getRuntime().exec(cmds);
     43            Runtime.getRuntime().exec(cmds.toArray(new String[0]));
    4444        } catch (Exception e) {
    4545            e.printStackTrace();
Note: See TracChangeset for help on using the changeset viewer.