/** * Copied from com.izforge.izpack.uninstaller.SelfModifier. Little addaption for this class. * * @param nextPhase phase of the spawn * @return created process object * @throws IOException */ private Process spawn(int nextPhase) throws IOException { String base = logFile.getAbsolutePath(); base = base.substring(0, base.length() - 4); // invoke from tmpdir, passing target method arguments as args, and // SelfModifier parameters as sustem properties String[] javaCmd = new String[]{ProcessHelper.getJavaCommand(), "-classpath", sandbox.getAbsolutePath(), "-D" + BASE_KEY + "=" + base, "-D" + PHASE_KEY + "=" + nextPhase, getClass().getName()}; StringBuilder sb = new StringBuilder("Spawning phase "); sb.append(nextPhase).append(": "); for (String aJavaCmd : javaCmd) { sb.append("\n\t").append(aJavaCmd); } log(sb.toString()); // Just invoke it and let it go, the exception will be caught above return ProcessHelper.exec(javaCmd); }
log("library cleanup done");