---
# System prepended metadata

title: From Kotlin source to execution of the generated bytecode
tags: [Kotlin]

---

###### tags: `Kotlin`

# From Kotlin source to execution of the generated bytecode

Write the simplest Kotlin file, and name it `Main.kt`: 

```kotlin=
fun main(args: Array<String>) {
    println("Hello world!")
}
```
Then compile the Kotlin file with `kotlinc`, which runs the Kotlin compiler

```bash
❯ kotlinc Main.kt
```

Then run the generated `MainKt.class` bytecode with 

```bash
❯ java -cp ~/.sdkman/candidates/kotlin/current/lib/kotlin-stdlib.jar:.  MainKt
```
(where `~/.sdkman/candidates/kotlin/current/lib/` is my actual path to the Kotlin `lib` folder).

And you'll get: 

```
Hello world!
```