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
@@ -58,6 +58,7 @@ abstract class AbstractRunner : Runner {
}
Thread.currentThread().contextClassLoader = classLoader
val savedClasspathProperty = System.setProperty("java.class.path", classpath.joinToString(File.pathSeparator))
try {
main.invoke(null, arguments.toTypedArray())
@@ -68,6 +69,10 @@ abstract class AbstractRunner : Runner {
catch (e: InvocationTargetException) {
throw e.targetException
}
finally {
if (savedClasspathProperty == null) System.clearProperty("java.class.path")
else System.setProperty("java.class.path", savedClasspathProperty)
}
}
}