I'm trying to convert my JSR-223 usages into the n...
# scripting
s
I'm trying to convert my JSR-223 usages into the new experimental scripting API, but every script I attempt to compile gives me two errors: - One instance of
No class roots are found in the JDK path: /usr/lib64/openjdk-8/jre
- Several instances of
Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option
How can I address these?
c
First seems you're not using proper JDK, but a JRE instead. Second can be fixed with compiler configuration. We need more information about your build environment though to give you better suggestions.
s
I'm building on Linux, with the JDK at
/usr/lib64/openjdk-8
. I do have a proper JDK, but the scripting compiler seems to only want to use the JRE.
If I manually set the javaHome property to
/usr/lib64/openjdk-8
, that error goes away, but the inlining errors persist.
It doesn’t seem to matter what arguments I pass to the scripting compiler, nor what I have IntelliJ or Gradle set to target (1.8 or 1.6). The errors remain.
c
So let's concentrate on the inlining error then. Can you show compiler configuration and invocation? Specifically, how do you configure
ScriptCompilationConfiguration
?
s
Identically to the basic scripting example in the Kotlin repo, with a compilationConfiguration added to the base KotlinScript class to set the javaHome property.
n
@Czar i have the same issue.. the script configuration currently ignores the passed compiler arguments
c
I'm switching to Nikky's problem since there I can at least see the code 🙂 @serebit you can check it out when we fix it 🙂 @Nikky am I right in assuming you're talking about your MinimalScriptExample repo?
I've found two issues there:
MinimalScriptingExample\src\main\kotlin\example\script\ScriptEnvironmentConfiguration.kt:19
you have a spelling mistake:
-jvm-targe
should be
-jvm-target
in
MinimalScriptingExample\src\main\kotlin\example\script\ScriptEnvironment.kt:8
fileExtension = voodoo.kts
should probably be
fileExtension = kts
or omitted (unless I'm missing something and your script files look like
something.voodoo.kts
)
n
well i designed the minimal scripting example to work..
i think this error only shows up if you compile your script against some library that was built with the usual
-jvm-target 8
oh i missed that.. i copied it from my own stuff.. i should make this .example.kts
c
@serebit you can check out Nikky's example and with two changes I've mentioned you can modify and use it for your purposes: https://github.com/NikkyAI/MinimalScriptingExample
n
@Czar i updated it.. now it fails just like my more complex seperate project
i am not sure if its the operator function or the fact that it uses inline classes.. but the log is pretty clear in one regard..
c
@Nikky can you also share your
hello.example.kts
, because mine works
n
it is in the repo
or should be.. wait..
now it is
just clone and execute
./gradlew run
should reproduce it
c
ok, now it works, or rather doesn't 😄
n
well i have to go.. i hope you can find a workaround.. this error has been blocking me for months
also please upvote this: https://youtrack.jetbrains.com/issue/KT-27815 so maybe it surfaces in the issue tracker and gets fixed
s
Will do. Seems like the main issue I’m having is being unable to set the jvm-target for the scripting compiler, even through the exposed compilerOptions property (so that issue exactly). Hopefully it gets fixed soon.
c
I've found the probable culprit and will try to contribute a fix next week
💯 1
s
Bless 🙏🏿