< prev index next >
test/jdk/tools/launcher/modules/classpath/JavaClassPathTest.java
Print this page
rev 51638 : [mq]: 8210112
@@ -27,28 +27,31 @@
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.spi.ToolProvider;
+import java.util.stream.Stream;
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.Platform;
import jdk.test.lib.compiler.CompilerUtils;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.assertTrue;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
/**
* @test
* @bug 8168205
* @summary Test the default class path if -Djava.class.path is set
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
* jdk.jartool
- * @build jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @build jdk.test.lib.compiler.CompilerUtils
* @run testng JavaClassPathTest
*/
public class JavaClassPathTest {
private static final Path SRC_DIR = Paths.get(System.getProperty("test.src"),
@@ -195,32 +198,31 @@
assertTrue(execute(args).getExitValue() == 0);
}
private OutputAnalyzer execute(List<String> options) throws Throwable {
- ProcessBuilder pb = createJavaProcessBuilder(
+ // can't use ProcessTools.createJavaProcessBuilder as it always adds -cp
+ ProcessBuilder pb = new ProcessBuilder(
+ Stream.concat(Stream.of(JDKToolFinder.getTestJDKTool("java")),
options.stream()
- .map(this::autoQuote)
+ .map(this::autoQuote))
.toArray(String[]::new)
);
Map<String,String> env = pb.environment();
// remove CLASSPATH environment variable
- String value = env.remove("CLASSPATH");
+ env.remove("CLASSPATH");
return executeCommand(pb)
.outputTo(System.out)
.errorTo(System.out);
}
- private static final boolean IS_WINDOWS
- = System.getProperty("os.name").startsWith("Windows");
-
/*
* Autoquote empty string argument on Windows
*/
private String autoQuote(String arg) {
- if (IS_WINDOWS && arg.isEmpty()) {
+ if (Platform.isWindows() && arg.isEmpty()) {
return "\"\"";
}
return arg;
}
}
< prev index next >