Ignores %PATH/java, use $JAVA_HOME/bin/java instead

Deduce `java` executable from current "java.home" property to spawn
processes for test purposes.
This commit is contained in:
Thiago Kronig 2015-05-14 09:36:26 -03:00 committed by Clebert Suconic
parent 3b7ac292c8
commit 351b1cba5d
1 changed files with 3 additions and 1 deletions

View File

@ -20,6 +20,7 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.file.Paths;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
@ -70,7 +71,8 @@ public final class SpawnedVMSupport
final String... args) throws Exception
{
ProcessBuilder builder = new ProcessBuilder();
builder.command("java", memoryArg1, memoryArg2, "-cp", System.getProperty("java.class.path"));
final String javaPath = Paths.get(System.getProperty("java.home"), "bin", "java").toAbsolutePath().toString();
builder.command(javaPath, memoryArg1, memoryArg2, "-cp", System.getProperty("java.class.path"));
List<String> commandList = builder.command();