-
Notifications
You must be signed in to change notification settings - Fork 126
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
Installation problem #15
Comments
Sorry for inconvenience. What version of kotlin are you using? Just type kotlinc -version |
MBP-MarcinMac:~ marcin$ kotlinc -version |
Indeed Feel welcome to vote for it, because JB is more likely to act upon it if there are some votes. |
They suggested a workaround and I will release a patched version of |
I've released kscript v1.2 this morning which should solve the problem. You can run the auto-update with kscript --self-update Feel welcome if you have other issues when using |
I'm getting the same error on Linux: kscript: 1.2 (15c7cc4)
kotlinc is installed correctly and working OK. |
I see the fix makes use of
It could be a safe default if it's not defined: -exec kotlin ${kotlin_opts} -classpath ${jarFile}:${KOTLIN_HOME}/lib/kotlin-script-runtime.jar:"$classpath" Main_${className} "$@"
+exec kotlin ${kotlin_opts} -classpath ${jarFile}:${KOTLIN_HOME:-/usr/share/kotlin}/lib/kotlin-script-runtime.jar:"$classpath" Main_${className} "$@" Alternatively, you could adopt the same approach as kotlin-script. Or possibly even scrape it out of kotlinc e.g.:
|
Thanks for the hint. |
Thanks, but that particular solution doesn't work on my system:
That means it looks for the JAR in:
Rather than where it actualy resides:
Like I say, the correct path can be exposed by the kotlinc script (or its kotlin wrapper) if you don't mind doing a bit of light scraping:
|
Just out of curiosity. How did kotlin end up under /usr/share/? homebrew? I always use sdkman which just dumps it in a hidden directory in the user home. I'd think it would be better to avoid another JVM launch (which costs another few hundred milliseconds). Especially for small inlined command-line tools this may make a difference for some users. So what about (see also latest commit):
|
It's the standard location for application data on Arch Linux.
It doesn't launch the JVM:
|
Thanks for your patience. Could you try again. I've changed it to
I'm still confused/amazed by |
Yes, that works. Thanks!
It's just an environment variable assignment, the same as running: env JAVACMD=echo kotlin or setting: JAVACMD=echo in kotlinc. The $ time JAVACMD=echo kotlin
real 0m0.019s
user 0m0.000s
sys 0m0.000s
$ time KOTLIN_RUNNER=1 JAVACMD=echo kotlinc
real 0m0.012s
user 0m0.000s
sys 0m0.000s
"${JAVACMD:=java}" $JAVA_OPTS "${java_args[@]}" -cp "${kotlin_app[@]}" "${kotlin_args[@]}" If not supplied it defaults to
This prints out the java_args=("${java_args[@]}" "-Dkotlin.home=${KOTLIN_HOME}") IMO, it's safer to just use the defined $ KOTLIN_HOME=$(KOTLIN_RUNNER=1 JAVACMD=echo kotlinc | awk 'NR>1' RS=' ' | grep -F kotlin.home= | cut -d= -f2)
$ echo $KOTLIN_HOME
/usr/share/kotlin |
Thanks for the nice explanation. I've changed it accordingly. |
Hey, I installed it on mac exactly like in instructions. Not in /bin because it is not permitted in new mac, but in another folder and I added it to PATH, but when I start any script using kscript I get:
The text was updated successfully, but these errors were encountered: