-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kscript execution - java.lang.ClassNotFoundException #109
Comments
I think it's more a kotlin platform issue than a kscript bug, because cat <<"EOF" > test_processing.kts
import processing.core.PApplet
class Sketch : PApplet() {
override fun settings() {
size(800, 600)
}
override fun setup() {
background(0)
}
}
val className= Sketch::class.qualifiedName
println("class name is $className")
PApplet.main(Sketch::class.java)
EOF
kotlinc -help
kotlinc -cp ~/.m2/repository/org/processing/core/3.3.6/core-3.3.6.jar -script test_processing.kts -Djava.awt.headless=false
fails with the same error. I think it is also unrelated to cat <<"EOF" > test_classloader.kts
class Sketch {
fun foo() = println("bar")
}
val className= Sketch::class.qualifiedName
println("class name is $className")
// val classLoader = String::class.java.getClassLoader()
val classLoader = javaClass.classLoader
println("classLoader is $classLoader")
val sketchClass = classLoader.loadClass(Sketch::class.qualifiedName)
println("sketchClass is $sketchClass")
EOF
kotlinc -script test_classloader.kts which fails with
Interestingly it seems fine when running as cat <<"EOF" > test.kt
//ENTRY Foo
class Sketch {
fun foo() = println("bar")
}
object Foo{
@JvmStatic
fun main(args: Array<String>) {
val className= Sketch::class.qualifiedName
println("class name is $className")
val classLoader =javaClass.classLoader
println("classLoader is $classLoader")
val sketchClass = classLoader.loadClass(Sketch::class.qualifiedName)
println("sketchClass is $sketchClass")
}
}
EOF
kotlinc test.kt
kotlin Foo So, I'd suggest that you submit these last two snippets (without any processing dependency) as kotlln platform bug. Feel welcome to point me to the corresponding ticket. |
Irrespective of the classloader issue when using script mode from above, the problem also remains when using
This might be another/related platform issue or differences in how I'm closing the ticket for now, since it is not really a |
Thanks! I'll dive into your exploration and rise issue to kotlin platform. |
Source file (
sketch1.kts
):Execution command:
kscript sketch1.kts
.Expected result: black window.
Actual result:
However, packaging works as expected.
The text was updated successfully, but these errors were encountered: