- Timestamp:
- 2014-12-01T00:16:20+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/RestartAction.java
r7487 r7755 90 90 } 91 91 } else { 92 // java binary 93 final String java = System.getProperty("java.home") + File.separator + "bin" + File.separator + 94 (Main.isPlatformWindows() ? "java.exe" : "java"); 95 if (!new File(java).isFile()) { 96 throw new IOException("Unable to find suitable java runtime at "+java); 97 } 98 cmd.add(java); 92 // java binary is resolved later 93 cmd.add(null); 99 94 // vm arguments 100 95 for (String arg : ManagementFactory.getRuntimeMXBean().getInputArguments()) { … … 105 100 } 106 101 } 107 // program main and program arguments (be careful a sun property. might not be supported by all JVM) 108 String[] mainCommand = System.getProperty("sun.java.command").split(" "); 109 // look for a .jar in all chunks to support paths with spaces (fix #9077) 110 String jarPath = mainCommand[0]; 111 for (int i = 1; i < mainCommand.length && !jarPath.endsWith(".jar"); i++) { 112 jarPath += " " + mainCommand[i]; 113 } 114 // program main is a jar 115 if (jarPath.endsWith(".jar")) { 116 // if it's a jar, add -jar mainJar 117 cmd.add("-jar"); 118 cmd.add(new File(jarPath).getPath()); 102 final String javadir = System.getProperty("java.home") + File.separator + "bin" + File.separator; 103 final String java; 104 // Detect JNLP files launched with jp2launcher 105 boolean jp2launcher = cmd.contains("-secure") && cmd.contains("-javaws"); 106 if (jp2launcher) { 107 java = javadir + (Main.isPlatformWindows() ? "jp2launcher.exe" : "jp2launcher"); 119 108 } else { 120 // else it's a .class, add the classpath and mainClass 121 cmd.add("-cp"); 122 cmd.add("\"" + System.getProperty("java.class.path") + "\""); 123 cmd.add(mainCommand[0]); 124 } 125 // if it's webstart add JNLP file 126 String jnlp = System.getProperty("jnlp.application.href"); 127 if (jnlp != null) { 128 cmd.add(jnlp); 129 } 130 // finally add program arguments 131 cmd.addAll(Arrays.asList(Main.commandLineArgs)); 109 java = javadir + (Main.isPlatformWindows() ? "java.exe" : "java"); 110 } 111 if (!new File(java).isFile()) { 112 throw new IOException("Unable to find suitable java runtime at "+java); 113 } 114 cmd.set(0, java); 115 if (!jp2launcher) { 116 // program main and program arguments (be careful a sun property. might not be supported by all JVM) 117 String[] mainCommand = System.getProperty("sun.java.command").split(" "); 118 // look for a .jar in all chunks to support paths with spaces (fix #9077) 119 String jarPath = mainCommand[0]; 120 for (int i = 1; i < mainCommand.length && !jarPath.endsWith(".jar"); i++) { 121 jarPath += " " + mainCommand[i]; 122 } 123 // program main is a jar 124 if (jarPath.endsWith(".jar")) { 125 // if it's a jar, add -jar mainJar 126 cmd.add("-jar"); 127 cmd.add(new File(jarPath).getPath()); 128 } else { 129 // else it's a .class, add the classpath and mainClass 130 cmd.add("-cp"); 131 cmd.add("\"" + System.getProperty("java.class.path") + "\""); 132 cmd.add(mainCommand[0]); 133 } 134 // if it's webstart add JNLP file 135 String jnlp = System.getProperty("jnlp.application.href"); 136 if (jnlp != null) { 137 cmd.add(jnlp); 138 } 139 // finally add program arguments 140 cmd.addAll(Arrays.asList(Main.commandLineArgs)); 141 } 132 142 } 133 143 Main.info("Restart "+cmd);
Note:
See TracChangeset
for help on using the changeset viewer.