diff --git a/test/jdk/java/foreign/UpcallTestHelper.java b/test/jdk/java/foreign/UpcallTestHelper.java index 3860080cf21..bbfa44aa346 100644 --- a/test/jdk/java/foreign/UpcallTestHelper.java +++ b/test/jdk/java/foreign/UpcallTestHelper.java @@ -21,13 +21,12 @@ * questions. */ -import jdk.test.lib.Utils; +import jdk.test.lib.process.ProcessTools; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -57,22 +56,15 @@ public class UpcallTestHelper extends NativeTestHelper { assert !target.isArray(); List command = new ArrayList<>(List.of( - Paths.get(Utils.TEST_JDK) - .resolve("bin") - .resolve("java") - .toAbsolutePath() - .toString(), "--enable-preview", "--enable-native-access=ALL-UNNAMED", "-Djava.library.path=" + System.getProperty("java.library.path"), "-Djdk.internal.foreign.UpcallLinker.USE_SPEC=" + useSpec, - "-cp", Utils.TEST_CLASS_PATH, target.getName() )); command.addAll(Arrays.asList(programArgs)); - Process process = new ProcessBuilder() - .command(command) - .start(); + + Process process = ProcessTools.createTestJvm(command).start(); int result = process.waitFor(); assertNotEquals(result, 0);