问题描述
我对Kotlin完全陌生,我正在尝试运行Kotlin REPL.
I am completely new to Kotlin, and I am trying to run the Kotlin REPL.
在此之后,考虑我正在使用OS X,我已经尝试过:
Following this, and considering I am using OS X, and I have tried this:
$ /usr/local/bin/kotlinc-jvm
等效于:
$ kotlinc-jvm
然后在以下链接中,我发现一种更好的运行方式是:
Then in the following link, I found that a nicer way to run it is:
$ kotlinc
这两个命令之间有什么区别,我应该选择哪一个?
Is there any differences between this two commands, and which one should I choose?
推荐答案
如果您查看kotlinc-jvm
文件,它们实际上只是启动与它们位于同一文件夹中的kotlinc
,并传递它们分别为始于它:
If you look inside the kotlinc-jvm
files, they actually just launch the kotlinc
that's in the same folder they are in, and pass any arguments they were started with to it:
kotlinc-jvm
(对于Unix):
#!/usr/bin/env bash
# (License here)
DIR="${BASH_SOURCE[0]%/*}"
: ${DIR:="."}
"${DIR}"/kotlinc "$@"
kotlinc-jvm.bat
(对于Windows):
kotlinc-jvm.bat
for Windows:
@echo off
rem (License here)
call %~dps0kotlinc.bat %*
我不确定为什么kotlinc-jvm
会以这种形式出现,它基本上只是一个非常简单的重定向.我只用kotlinc
.
I'm not sure why kotlinc-jvm
is there in this form, it's basically just a very simple redirect. I'd just use kotlinc
.
这篇关于如何运行Kotlin REPL kotlinc-jvm或kotlinc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!