Set java.class.path property in runner and loader

#KT-24991 fixed
This commit is contained in:
Ilya Chernikov
2019-08-27 11:23:11 +02:00
parent 08720a3dc6
commit 31c56d7794
6 changed files with 38 additions and 10 deletions
+9 -1
View File
@@ -1,11 +1,19 @@
import java.io.File
object ContextClassLoaderTester {
@JvmStatic
fun main(args: Array<String>) {
kotlin.test.DefaultAsserter.assertTrue("", true) // this tests that kotlin-test is in the compilation and runtime classpaths
val contextClassLoader = Thread.currentThread().getContextClassLoader()
contextClassLoader.loadClass("kotlin.test.DefaultAsserter") // this tests that thread context classloader is set correctly
println("ok")
val classPathFromProp = System.getProperty("java.class.path")
val jarFromProps = classPathFromProp.split(File.pathSeparator).firstOrNull { it.contains("kotlin-test") }
println(jarFromProps?.let { File(it).name } ?: "kotlin-test.jar not found in the java.class.path property: $classPathFromProp")
}
}