从命令行编译Kotlin [英] Kotlin compiling from command line

查看:136
本文介绍了从命令行编译Kotlin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编译一些Kotlin文件并按照 Kotlin文档中所述运行它们。

I need to compile some Kotlin files and run them as described at Kotlin documentation

但是,我的命令行一直这样说:

However, my command line keeps saying this:


C: \用户\Tom\文档\ProjectEuler\Kotlin> kotlinc
'kotlinc'不被识别为内部或外部命令,
可操作程序或批处理文件。

C:\Users\Tom\Documents\ProjectEuler\Kotlin>kotlinc 'kotlinc' is not recognized as an internal or external command, operable program or batch file.

我是64位Windows 7用户。
所以我下载了最新版本的编译器(1.0.6 ATM)并将文件解压缩到我的Program Files文件夹中。

I am a 64-bit Windows 7 user. So I downloaded the latest version of the compiler (1.0.6 ATM) and extracted the files into my Program Files folder.

我的变量路径设置为


PATH = C:\Program Files\Java\jdk1.8.0_101\bin; C:\Program Files\kotlinc\bin\; C:\Program Files(x86)\Android\android-sdk\platform-tools;

PATH=C:\Program Files\Java\jdk1.8.0_101\bin; C:\Program Files\kotlinc\bin\;C:\Program Files (x86)\Android\android-sdk\platform-tools;

这时我还不知道,我尝试了两个版本的编译器并尝试更改过几次路径变量。

At this point I have no idea, I tried two versions of the compiler and tried changing the path variable few times.

推荐答案

Windows PATH以分号分隔;

Windows PATH is semicolon-delimited; white space is not trimmed.

您需要删除; C:\Program Files\kotlinc\bin\ ,以便将目录正确添加到PATH。

You need to remove the space between ; and C:\Program Files\kotlinc\bin\ in order for the directory to be added correctly to PATH.

这篇关于从命令行编译Kotlin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆