diff --git a/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac/JavacTurbineCompiler.java b/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac/JavacTurbineCompiler.java index 1a3b32f6692cb3..2db21b92db7ba1 100644 --- a/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac/JavacTurbineCompiler.java +++ b/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac/JavacTurbineCompiler.java @@ -16,6 +16,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; +import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.jimfs.Configuration; @@ -105,7 +106,9 @@ static JavacTurbineCompileResult compile(JavacTurbineCompileRequest request) thr @Override public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException { - files.put(classes.relativize(path).toString(), Files.readAllBytes(path)); + // use `/` as the directory separator for jar paths, even on Windows + String name = Joiner.on('/').join(classes.relativize(path)); + files.put(name, Files.readAllBytes(path)); return FileVisitResult.CONTINUE; } });