+ if (wait) {
+ while (EclipseStarter.isRunning()) {
+ Thread.sleep(500);
+ }
+ } else {
+ Thread.sleep(pause);
+ }
+ }
+
+ protected void execForked(LocationsStruct locationsStruct) throws Exception {
+ // Set defaults
+ if (jvmArgs == null)
+ jvmArgs = defaultJvmArgs;
+ if (args == null)
+ args = defaultArgs;
+ if (systemProperties == null)
+ systemProperties = new HashMap();
+
+ if (!execDir.exists())
+ execDir.mkdirs();
+
+ // Build command
+ List cmdList = new ArrayList();
+ // JVM
+ cmdList.add(jvm);
+ // JVM arguments
+ cmdList.addAll(Arrays.asList(jvmArgs));
+
+ if (!"0".equals(debug))
+ cmdList
+ .add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address="
+ + debug);
+
+ if (jvmArgsToAppend != null)
+ cmdList.addAll(Arrays.asList(jvmArgsToAppend));
+
+ // System properties
+ if (!systemProperties.containsKey("osgi.bundles"))
+ cmdList.add("-Dosgi.bundles="
+ + locationsStruct.osgiBootArtifact.getFile()
+ .getCanonicalPath() + "@start");
+ if (!systemProperties.containsKey("slc.osgi.locations"))
+ cmdList
+ .add("-Dslc.osgi.locations="
+ + locationsStruct.osgiLocations);
+ for (Iterator keys = systemProperties.keySet().iterator(); keys
+ .hasNext();) {
+ Object key = keys.next();
+ Object value = systemProperties.get(key);
+ String strValue = null;
+ if (value != null) {
+ strValue = value.toString().trim();
+ strValue = strValue.replaceAll("\n", "");
+ strValue = strValue.replaceAll("\t", "");
+ }
+ cmdList.add("-D" + key + "=" + strValue);
+ }
+
+ // Equinox jar
+ cmdList.add("-jar");
+ cmdList.add(locationsStruct.equinoxArtifact.getFile()
+ .getCanonicalPath());
+
+ // Program arguments
+ cmdList.addAll(Arrays.asList(args));
+ if (argsToAppend != null)
+ cmdList.addAll(Arrays.asList(argsToAppend));
+
+ String[] cmd = (String[]) cmdList.toArray(new String[0]);
+ System.out.println("Execute Equinox command (forked):");
+ printCommand(cmd);
+
+ SystemCall systemCall = new SystemCall(execDir.getCanonicalPath(), cmd,
+ true);
+ if (wait) {
+ systemCall.run();
+ } else {
+ new Thread(systemCall).start();
+ Thread.sleep(pause);