Kotlin / kotlin-interactive-shell

Kotlin Language Interactive Shell
Apache License 2.0
588 stars 36 forks source link

Unable to execute kotlin-interactive-shell using a symbolic link to ki.sh #68

Closed shoresea closed 3 years ago

shoresea commented 3 years ago

When trying to install the kotlin-interactive-shell on Unix manually and creating a symbolic link to bin/ki.sh, the symbolic link fails to execute the kotlin-interactive-shell with an error message:

Error: Unable to access jarfile /usr/local/bin/../lib/ki-shell-*.jar

where /usr/local/bin is the symbolic link path.

khud commented 3 years ago

Got it. Thank you. I will provide a fix asap. But there is a workaround: you can change ki.sh:

#!/usr/bin/env bash

KI_SHELL_HOME=path_to_your_ki_installation 
KI_SHELL=$KI_SHELL_HOME/lib/ki-shell.jar

java -jar ${KI_SHELL} $@
shoresea commented 3 years ago

Thank you for providing the workaround. But, I already fixed it by setting SCRIPT_DIR="$( dirname $(realpath "$0") )" in ki.sh to get the real path of ki.sh instead of getting the real path of the symbolic link.

I am not sure if realpath is available in all UNIX based system, so didn't raise a PR with this fix.

khud commented 3 years ago

Thank you I will check this option on Linux. I believe it might work.

khud commented 3 years ago

Thank you. Merged.

khud commented 3 years ago

It's a bit tricky. It will not work on MacOS but it's better anyway. I need some time to fix it for MacOS too.

shoresea commented 3 years ago

It can work on macOS by installing GNU coreutils which provides realpath. A simple brew install coreutils should do the trick.