Changeset 28438 in osm for applications/editors/josm


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

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

Location:
applications/editors/josm/plugins/restart
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/restart/.classpath

    • Property svn:executable deleted
  • applications/editors/josm/plugins/restart/.project

    • Property svn:executable deleted
  • applications/editors/josm/plugins/restart/LICENSE

    • Property svn:executable deleted
  • applications/editors/josm/plugins/restart/build.xml

    r27852 r28438  
    3030<project name="restart" default="dist" basedir=".">
    3131    <!-- enter the SVN commit message -->
    32     <property name="commit.message" value="Commit message"/>
     32    <property name="commit.message" value="fix #j5635 -- pass java start options when restarting"/>
    3333    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    3434    <property name="plugin.main.version" value="4980"/>
  • 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.