https://kotlinlang.org logo
#announcements
Title
# announcements
t

tarlekon

07/05/2017, 2:26 PM
hello, does anyone can help me with
K2JVMCompiler
?
o

orangy

07/05/2017, 2:29 PM
tarlekon: what are you trying to do?
t

tarlekon

07/05/2017, 2:30 PM
Zdravstvuite , mozem po russki ?
n

nfrankel

07/05/2017, 2:31 PM
nyet inachye, bedniye lyudi kak ya nye mogut ponimat
simple smile 2
👍 1
😆 6
t

tarlekon

07/05/2017, 2:34 PM
hello
Problem description in here :
and in here :
I get source code of kotlin kompiller. And see no way how to fix it without writing custom
K2JVMCompiler
o

orangy

07/05/2017, 2:36 PM
Did you see this? https://github.com/ligee/kotlin-jupyter cc @ilya.chernikov
t

tarlekon

07/05/2017, 2:36 PM
is "twosigma" linck is visible ?
yes I saw this
n

nfrankel

07/05/2017, 2:37 PM
@orangy was faster than me...
t

tarlekon

07/05/2017, 2:37 PM
Main problem that I do not have Kotlin local
and I have nothing to set in
kotlinHome
I get only java installed on local PC and can operate only with jar files
see "twosigma" link I write some solutions in "How to fix:" section
I described problem in detain in those links
any suggestions ? ideas ?
o

orangy

07/05/2017, 2:54 PM
I pinged @ilya.chernikov, he will respond when he has time.
t

tarlekon

07/05/2017, 2:58 PM
ok, thanks, will wait. Ask if something not clear.
i

ilya.chernikov

07/05/2017, 3:30 PM
Hi @tarlekon I see now that there is an answer here: https://discuss.kotlinlang.org/t/k2jvmcompiler/3629/2, that will probably solve your current issue. But you seems trying to use our internal classes to implement the functionality you want. While you’re of course free to do it, there will be problems on that way, since these parts are not designed as a public API. The problem your’e facing right now is exactly because of that:
K2JVMCompiler
is designed for command-line usage in the standard environment. If you’ll choose to “fix”
K2JVMCompiler
, you may meet the compatibility problem right on the next release, since we cannot guarantee compatibility for the internal classes. So, I wouldn’t recommend that. The “official way” (well, still with some reservations) to embed kotlin now is via JSR223 interface (see e.g. an example here - https://github.com/JetBrains/kotlin/tree/master/libraries/examples/kotlin-jsr223-local-example). The alternative would be to adapt aforementioned https://github.com/ligee/kotlin-jupyter for your needs. And while it also uses some compiler internals, these are the same used for the official JSR223 interface and therefore have more chances to remain as is. These variants are suitable for the script/REPL types of usages. We are thinking about providing more general “compiler API”, but there is nothing yet to rely on.
👍 1
t

tarlekon

07/05/2017, 3:52 PM
So can this functionality be implemented not based on
K2JVMCompiler
?
or for now it is only way ?
i

ilya.chernikov

07/06/2017, 6:59 AM
If your usage resembles a script execution or a REPL, then you’ll be better of with JSR-223 - https://github.com/JetBrains/kotlin/tree/master/libraries/examples/kotlin-jsr223-local-example