Do not try to load jrt file system from JDK version < 9
The FileSystems.newFileSystem call failed if the compiler was being run on Java 9 with -jdk-home $JDK_16
This commit is contained in:
@@ -45,12 +45,12 @@ class CoreJrtFileSystem(private val fileSystem: FileSystem) : DeprecatedVirtualF
|
|||||||
companion object {
|
companion object {
|
||||||
fun create(jdkHome: File): CoreJrtFileSystem? {
|
fun create(jdkHome: File): CoreJrtFileSystem? {
|
||||||
val rootUri = URI.create(StandardFileSystems.JRT_PROTOCOL + ":/")
|
val rootUri = URI.create(StandardFileSystems.JRT_PROTOCOL + ":/")
|
||||||
|
val jrtFsJar = loadJrtFsJar(jdkHome) ?: return null
|
||||||
val fileSystem =
|
val fileSystem =
|
||||||
if (SystemInfo.isJavaVersionAtLeast("9")) {
|
if (SystemInfo.isJavaVersionAtLeast("9")) {
|
||||||
FileSystems.newFileSystem(rootUri, mapOf("java.home" to jdkHome.absolutePath))
|
FileSystems.newFileSystem(rootUri, mapOf("java.home" to jdkHome.absolutePath))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
val jrtFsJar = loadJrtFsJar(jdkHome) ?: return null
|
|
||||||
val classLoader = URLClassLoader(arrayOf(jrtFsJar.toURI().toURL()), null)
|
val classLoader = URLClassLoader(arrayOf(jrtFsJar.toURI().toURL()), null)
|
||||||
FileSystems.newFileSystem(rootUri, emptyMap<String, Nothing>(), classLoader)
|
FileSystems.newFileSystem(rootUri, emptyMap<String, Nothing>(), classLoader)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user