diff --git a/flo-runner/src/main/java/com/spotify/flo/context/ForkingExecutor.java b/flo-runner/src/main/java/com/spotify/flo/context/ForkingExecutor.java index ac402426b..58c750f32 100644 --- a/flo-runner/src/main/java/com/spotify/flo/context/ForkingExecutor.java +++ b/flo-runner/src/main/java/com/spotify/flo/context/ForkingExecutor.java @@ -23,9 +23,9 @@ import com.spotify.flo.Fn; import com.spotify.flo.Serialization; import com.spotify.flo.SerializationException; -import com.spotify.flo.freezer.PersistingContext; import java.io.BufferedReader; import java.io.Closeable; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -48,6 +48,7 @@ import java.util.Objects; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -135,9 +136,14 @@ void start() { } catch (SerializationException e) { throw new RuntimeException("Failed to serialize closure", e); } - - final ProcessBuilder processBuilder = new ProcessBuilder(java.toString(), "-cp", classPath) - .directory(workdir.toFile()); + + final String absoluteClassPath = + Arrays.stream(classPath.split(File.pathSeparator)) + .map(cp -> Paths.get(cp).toAbsolutePath().toString()) + .collect(Collectors.joining(File.pathSeparator)); + + final ProcessBuilder processBuilder = + new ProcessBuilder(java.toString(), "-cp", absoluteClassPath).directory(workdir.toFile()); // Propagate -Xmx and -D. // Note: This is suboptimal because if the user has configured a max heap size we will effectively use that