1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CLIで簡単にKotlinを動かす

1
Last updated at Posted at 2019-06-18

Kotlinインストール

Homebrewでインストール

$ brew install kotlin

jarにコンパイルして実行

コーディング

hello.kt を作成

hello.kt
fun main(args: Array<String>) {
    println("Hello, World!")
}

コンパイル

kotlinc で jarファイルにコンパイル

$ kotlinc hello.kt -include-runtime -d hello.jar

Hello, World!実行!

$ kotlin hello.jar
Hello, World!

ヤッタネ!

scriptファイルとして実行

コーディング

hello.kts を作成

hello.kts
println("Hello, World!")

scriptオプションを付けて実行!

$ kotlinc -script hello.kts
Hello, World!

ヤッタネ!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?