[JAVA] "Hello, World!" With Kotlin + CLI in 5 minutes

Kotlin has a strong image of Android development, but since it is a general-purpose language that is compatible with Java and can be used on the server side, I tried Kotlin easily on the command line without using an IDE.

procedure

Install Kotlin compiler

$ brew update
$ brew install kotlin

coding

$ vim hello.kt
...(Edit with your favorite editor)
$ cat hello.kt 
fun main(args: Array<String>) {
    println("Hello, World!")
}

Compile & run

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

reference

Recommended Posts

"Hello, World!" With Kotlin + CLI in 5 minutes
Hello world with Kotlin and JavaFX
Hello world with Kotlin and Tornado FX
"Hello World" in Java
Hello World in Java
Hello World with Micronaut
Hello World with JavaFX 11 (OpenJFX) in Liberica JDK 11
Hello World with Spring Boot
Hello World with Spring Boot!
Hello World with VS Code!
Hello World with Spring Boot
Hello World with SpringBoot / Gradle
Hello, World! With Asakusa Framework!
Spring Boot Hello World in Eclipse
Until "Hello World" with Spring Boot
Hello World with Docker and C
(Intellij) Hello World with Spring Boot
Hello World with GlassFish 5.1 + Servlet + JSP
Create PDF with itext7 ~ Hello World ~
hello, world in Vanilla Java-EHW2018 "MVP"
"Hello world" for ImageJ with Eclipse
Hello World with GWT 2.8.2 and Maven
Continuous inspection in 5 minutes with SonarQube
Hello world in Java and Gradle
Hello World with Eclipse + Spring Boot + Maven
Hello, World! In the bootstrap loader area
Hello world with Java template engine Thymeleaf
Java development with Codenvy: Hello World! Run
How Spring Security works with Hello World
(IntelliJ + gradle) Hello World with Spring Boot
HMAC in Kotlin
Hello world! With Spring Boot (Marven + text editor)
Hello World at explosive speed with Spring Initializr! !! !!
Read "Hello world"
Run JSP Hello World with Tomcat on Docker
Java, Hello, world!
[Java] Hello World with Java 14 x Spring Boot 2.3 x JUnit 5 ~
Java Hello World
Display "Hello World" in the browser using Java
Display "Hello World" in the browser using Java
Show a simple Hello World with SpringBoot + IntelliJ
Try to display hello world with spring + gradle
Easy to display hello world with Rails + Docker
Hello World (REST API) with Apache Camel + Spring Boot 2
Hello World (console app) with Apache Camel + Spring Boot 2
CLI creation with thor
Java Learning (1)-Hello World
Read System.out.println ("hello, world")
Let's write Hello World
Big Decimal in Kotlin
Value object in 3 minutes
Hello World on WebAssembly
[Java] One type of alphabet prohibited With binding Hello, world! [Binding]
Hello World with Ruby extension library for the time being
Make a simple CRUD with SpringBoot + JPA + Thymeleaf ① ~ Hello World ~
Find the number of days in a month with Kotlin