# Can the kotiln compiler use a classloader for its classpath?

**URL:** <https://discuss.kotlinlang.org/t/can-the-kotiln-compiler-use-a-classloader-for-its-classpath/7434>\
**Category:** Support\
**Created:** [April 16, 2018, 3:35pm UTC](https://discuss.kotlinlang.org/t/can-the-kotiln-compiler-use-a-classloader-for-its-classpath/7434 "2018-04-16T15:35:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![swsieber](https://avatars.discourse-cdn.com/v4/letter/s/ee7513/32.png) [@swsieber](https://discuss.kotlinlang.org/u/swsieber)\
**Post date:** [April 16, 2018, 3:35pm UTC](https://discuss.kotlinlang.org/t/can-the-kotiln-compiler-use-a-classloader-for-its-classpath/7434/1 "2018-04-16T15:35:47Z")

</div>

I’m working on a Jenkins plugin to allow kotlin to be used for the admin scripting console. I was able to get things working using the kotlin-compiler-embeddable (I used the embeddable because of guava version conflict issues). Right now I have things working by doing some funky introspection to find the locations of the jars and other class files loaded by jenkins, and then passing those locations as a string to the K2JVMCompiler args. It works well enough, but is a little slow due to loading a large number of classes, and it might not work for all Jenkins installations.

Is it possible to pass a classloader to the compiler (well, the byte code generator), instead of a class path. I’ve been poking around and it seems like you might be able to somehow map a URLClassloader to a set of VirtualFile, but I’m not sure.

Anybody know if it’s possible?
