I am trying to use Kotlin with Processsing and it works fine in IntelliJ; however, I am having some classloader trouble with the REPL. I think the Kotlin classpath is not being passed along to the Java classloader properly.
./kotlinc -cp /Applications/Processing2.app/Contents/Java/core.jar:p5.jar
Welcome to Kotlin version 1.0.0-beta-1038 (JRE 1.7.0_67-b01)
Type :help for help, :quit for quit
>>> System.setProperty(“java.awt.headless”, “false”)
true
>>> import kp5.*
>>> val sketch = createSketch(500, 500)
java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: You need to use “Import Library” to add processing.core.PGraphicsJava2D to your sketch. at processing.core.PApplet.makeGraphics(PApplet.java:1952) at processing.core.PApplet.init(PApplet.java:972) at kp5.Kp5.startSketch(p5.kt:33) at kp5.P5Kt.createSketch(p5.kt:85) at kp5.P5Kt.createSketch$default(p5.kt:83) at kp5.P5Kt.<clinit>(p5.kt:77) at Line3.<init>(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
I modified some of the code in ReplFromTerminal and ReplInterpreter as a workaround to make Java use the Kotlin classloader but I am not sure if that is necessary.
Could you please create an issue at youtrack.jetbrains.com? Also would be nice if you could explain there why the workaround with the context class loader helps REPL with the library you're using. Thank you!
P.S. Given that I do not understand the workaround, it would be very helpful if someone could at least provide some code that could be used in the repl to get the class loader to work.