21 * questions.
22 */
23
24 package jdk.testlibrary;
25
26 import java.util.ArrayList;
27 import java.util.Arrays;
28 import java.util.List;
29
30 /**
31 * A utility for constructing command lines for starting JDK tool processes.
32 *
33 * The JDKToolLauncher can in particular be combined with a
34 * java.lang.ProcessBuilder to easily run a JDK tool. For example, the following
35 * code run {@code jmap -heap} against a process with GC logging turned on for
36 * the {@code jmap} process:
37 *
38 * <pre>
39 * {@code
40 * JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
41 * .addVMArg("-XX:+PrintGC");
42 * .addVMArg("-XX:+PrintGCDetails")
43 * .addToolArg("-heap")
44 * .addToolArg(pid);
45 * ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
46 * Process p = pb.start();
47 * }
48 * </pre>
49 * @deprecated This class is deprecated. Use the one from
50 * {@code <root>/test/lib/share/classes/jdk/test/lib}
51 */
52 @Deprecated
53 public class JDKToolLauncher {
54 private final String executable;
55 private final List<String> vmArgs = new ArrayList<String>();
56 private final List<String> toolArgs = new ArrayList<String>();
57
58 private JDKToolLauncher(String tool, boolean useCompilerJDK) {
59 if (useCompilerJDK) {
60 executable = JDKToolFinder.getJDKTool(tool);
61 } else {
62 executable = JDKToolFinder.getTestJDKTool(tool);
|
21 * questions.
22 */
23
24 package jdk.testlibrary;
25
26 import java.util.ArrayList;
27 import java.util.Arrays;
28 import java.util.List;
29
30 /**
31 * A utility for constructing command lines for starting JDK tool processes.
32 *
33 * The JDKToolLauncher can in particular be combined with a
34 * java.lang.ProcessBuilder to easily run a JDK tool. For example, the following
35 * code run {@code jmap -heap} against a process with GC logging turned on for
36 * the {@code jmap} process:
37 *
38 * <pre>
39 * {@code
40 * JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
41 * .addVMArg("-Xlog:gc*=debug")
42 * .addToolArg("-heap")
43 * .addToolArg(pid);
44 * ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
45 * Process p = pb.start();
46 * }
47 * </pre>
48 * @deprecated This class is deprecated. Use the one from
49 * {@code <root>/test/lib/share/classes/jdk/test/lib}
50 */
51 @Deprecated
52 public class JDKToolLauncher {
53 private final String executable;
54 private final List<String> vmArgs = new ArrayList<String>();
55 private final List<String> toolArgs = new ArrayList<String>();
56
57 private JDKToolLauncher(String tool, boolean useCompilerJDK) {
58 if (useCompilerJDK) {
59 executable = JDKToolFinder.getJDKTool(tool);
60 } else {
61 executable = JDKToolFinder.getTestJDKTool(tool);
|