diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/JarFileArchive.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/JarFileArchive.java index 3ccb32009f..a38379de90 100755 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/JarFileArchive.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/launch/JarFileArchive.java @@ -113,7 +113,7 @@ class JarFileArchive implements Archive { if (!Files.exists(path) || Files.size(path) != jarEntry.getSize()) { unpack(jarEntry, path); } - return JarUrl.create(path.toFile()); + return path.toUri().toURL(); } private Path getTempUnpackDirectory() { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/launch/JarFileArchiveTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/launch/JarFileArchiveTests.java index ac4a521388..94fd60609d 100755 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/launch/JarFileArchiveTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/launch/JarFileArchiveTests.java @@ -112,7 +112,8 @@ class JarFileArchiveTests { assertThat(urls).hasSize(1); URL url = urls.iterator().next(); assertThat(url).isNotEqualTo(JarUrl.create(this.file, "nested.jar")); - assertThat(url.toString()).startsWith("jar:file:").endsWith("/nested.jar!/"); + // The unpack URL must be a raw file URL (see gh-38833) + assertThat(url.toString()).startsWith("file:").endsWith("/nested.jar").doesNotStartWith("jar:"); } @Test