简体   繁体   English

我怎样才能运行Kotlin REPL kotlinc-jvm或kotlinc

[英]How can I run the Kotlin REPL kotlinc-jvm or kotlinc

I am completely new to Kotlin, and I am trying to run the Kotlin REPL. 我对Kotlin来说是全新的,我正在尝试运行Kotlin REPL。

Following this , and considering I am using OS X, and I have tried this: 之后,考虑到我使用的是OS X,我试过这个:

$ /usr/local/bin/kotlinc-jvm

which is equivalent to: 这相当于:

$ 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? 这两个命令之间有什么区别,我应该选择哪一个?

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文件,它们实际上只是启动它们kotlinc的文件夹中的kotlinc ,并将它们启动的任何参数传递给它:

kotlinc-jvm for Unix: kotlinc-jvm于Unix的kotlinc-jvm

#!/usr/bin/env bash

# (License here)

DIR="${BASH_SOURCE[0]%/*}"
: ${DIR:="."}

"${DIR}"/kotlinc "$@"

kotlinc-jvm.bat for Windows: kotlinc-jvm.bat于Windows的kotlinc-jvm.bat

@echo off

rem (License here)

call %~dps0kotlinc.bat %*

I'm not sure why kotlinc-jvm is there in this form, it's basically just a very simple redirect. 我不确定为什么kotlinc-jvm在这种形式中存在,它基本上只是一个非常简单的重定向。 I'd just use kotlinc . 我只是用kotlinc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM