zoukankan      html  css  js  c++  java
  • Sublime Text 编译运行Kotlin

    Sublime Text 编译运行Kotlin

    转 https://blog.csdn.net/pirate7777777/article/details/72655293 

    kotlin最近是火了,所以想试试看,当然 IntelliJ 是非常好用的啦,但是打开有点慢啦,对于我这种刚刚接触Kotlin的小白来说。。。(我就是急性子0.0.)

    所以想还是试试能不能用Sublime Text直接编译运行啦,话不多说,直接上干货:

    我已经默认了机器装好了java环境。

    1.首先就是下载kotlin-compiler-1.1.2-2.zip 

    将其解压到任意目录,然后把其中bin目录加入环境变量。

    参考这里:https://kotlinlang.org/docs/tutorials/command-line.html

    命令提示符下输入kotlinc :

    环境变量设置完成,":quit" 退出。

    2.Sublime Text 下:Tools-->Build System-->New Build System…

    如下代码:


    {
    "cmd": ["kotlinc","$file_name","-include-runtime","-d","${file_base_name}.jar","&&", "java","-jar", "${file_base_name}.jar"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.Konlin",
    "shell":true
    }

    保存为 kotlinc.sublime-build 文件。(此文件目录在Sublime Text的 Preferences-->Browse Packages...  User 目录下)

    如windows10下为C:UsersAdministratorAppDataRoamingSublime Text 3PackagesUser

    然后重启sublime text,就可正常编译和运行kotlin源程序了。

    写个HelloWorld 试试,Ctrl+B试试:

    发现生成了一个hello.jar 命令行可直接运行此文件。用压缩软件可查看文件结构:

    还是觉得ST写点什么测试用挺方便。

    ps:小白刚刚接触Kotlin,还请大神们下手轻点0.0.


    参考:

    Working with the Command Line Compiler:

    https://kotlinlang.org/docs/tutorials/command-line.html

    Sublime Text Build System——编译运行Java:

    http://www.cnblogs.com/bananaplan/p/Sublime-Text-Run-Java.html
    ---------------------

  • 相关阅读:
    java 复习001
    Some_sort_algorithms
    Install_pygments
    Install_ruby
    Ubuntu_wifi&pppoe
    Some_problem_with_octopress
    复习C语言
    VSim [a Racing-simulator by Vell001]
    Hello, Github Blog
    我的新计划 《2Dof Racing Simulator》2014/3/9 20:30:00
  • 原文地址:https://www.cnblogs.com/it-tsz/p/11068243.html
Copyright © 2011-2022 走看看