56 static void run_javac(String... args) throws IOException, InterruptedException { |
56 static void run_javac(String... args) throws IOException, InterruptedException { |
57 File javaHome = new File(System.getProperty("java.home")); |
57 File javaHome = new File(System.getProperty("java.home")); |
58 if (javaHome.getName().equals("jre")) |
58 if (javaHome.getName().equals("jre")) |
59 javaHome = javaHome.getParentFile(); |
59 javaHome = javaHome.getParentFile(); |
60 File javac = new File(new File(javaHome, "bin"), "javac"); |
60 File javac = new File(new File(javaHome, "bin"), "javac"); |
61 String toolOpts = System.getProperty("test.tool.vm.opts"); |
|
62 |
61 |
63 List<String> opts = new ArrayList<>(); |
62 List<String> opts = new ArrayList<>(); |
64 opts.add(javac.getPath()); |
63 opts.add(javac.getPath()); |
65 opts.addAll(Arrays.asList(toolOpts.trim().split("[\\s]+"))); |
64 |
|
65 String toolOpts = System.getProperty("test.tool.vm.opts"); |
|
66 if (toolOpts != null && !"".equals(toolOpts.trim())) { |
|
67 opts.addAll(Arrays.asList(toolOpts.trim().split("[\\s]+"))); |
|
68 } |
66 opts.addAll(Arrays.asList(args)); |
69 opts.addAll(Arrays.asList(args)); |
67 System.out.println("exec: " + opts); |
70 System.out.println("exec: " + opts); |
68 ProcessBuilder pb = new ProcessBuilder(opts); |
71 ProcessBuilder pb = new ProcessBuilder(opts); |
69 pb.redirectErrorStream(); |
72 pb.redirectErrorStream(); |
70 Process p = pb.start(); |
73 Process p = pb.start(); |