1. First understanding of kotlin and environment configuration

1. Kotlin is a statically typed programming language that can run on the java virtual machine or be compiled into JavaScript source code.

2. Download address of IntelliJ IDEA development tools: https://www.jetbrains.com/products/#type=ide

3. Kotlin-compiler-1.xx download address: https://github.com/JetBrains/kotlin

Four, use Kotlin command to run a piece of code

1)创建一个 Kotlin类 —— hello.kt
2)代码如下:
/**
	 * Created by oliver on 2021/01/19.
	 */
	fun main(args: Array<String>) {
    
    
		println("Hello world!");
	}
3)编译文件( ./kotlinc D:\oliver\oliver_project\OliverKotlin\hello.kt ),此文件生成在当前目录下,包括成HelloKt.class和META-INF文件夹
4)运行(./kotlin HelloKt),不用带后缀。

5. Use the local JVM to run the JAR package containing Kotlin code

1)
./kotlinc D:\oliver\oliver_project\OliverKotlin\hello.kt -include-runtime -d D:\oliver\oliver_project\OliverKotlin\helloWorld.jar
2)使用java命令运行.jar包
java -jar D:\oliver\oliver_project\OliverKotlin\helloWorld.jar

Six, install kotlin

1)先安装软件包:Linux:SDKMAN, MacOSX:HomeBrew, Windows:Scoop
	以windows为例,Scoop安装方法网址:https://github.com/lukesampson/scoop
	1、打开windows powershell
	2、安装scoop:iwr -useb get.scoop.sh | iex
2)安装kotlin:scoop install kotlin

Seven, the role of the command

1、kotlin:运行kotlin脚本
2、kotlinc:编译Kotlin源码

Author: Cangshuipu witch cloud
blog: http: //blog.csdn.NET/amir_zt/
more original, please indicate the source, thank you.
https://blog.csdn.net/amir_zt/article/details/112848744

Guess you like

Origin blog.csdn.net/u011635351/article/details/112848744