it might sound a bit dumb but i want to know if th...
# javascript
p
it might sound a bit dumb but i want to know if there is a way to use a javascript library in a kotlin jvm project?
h
The documentation on kotlinlang.org is a great starting-place for this 🙂 See https://kotlinlang.org/docs/using-packages-from-npm.html
r
He said on the JVM.
You can potentially use Java’s scripting support (Nashorn): https://www.baeldung.com/java-nashorn
p
many thanks @Rob Elliot. Will dig into that.
h
Good point Rob, didn’t expect JVM related questions in the JS channel 😛 Isn’t Nashorn deprecated already? I think GraalVM (or if on Android: https://github.com/LiquidPlayer/LiquidCore) is better alternatives. Not sure though.
r
GraalVM isn’t the JVM, and neither is Android.
h
I know, but sometimes people are able to use GraalVM. And sometimes people say JVM when they work on Android.
p
i want use a javascript library in a ktor server.
r
I hadn’t realised Nashorn had been killed. They’ve actually removed it in JDK15.
p
according to this article https://michel-kraemer.github.io/citeproc-java/using/javascript-engines/ , the other option is V8
r
You can use GraalVM JavaScript on a normal JVM, it seems: https://github.com/oracle/graaljs/blob/master/docs/user/RunOnJDK.md
p
Trying to understand the implications on performance and maintainability now
s
jfyi: Nashorn has move to a standalone project like OpenJfx - https://github.com/openjdk/nashorn