Careeroza
Installing Kotlin and First Program
Ways to Run Kotlin
| Option | Best for |
|---|---|
| IntelliJ IDEA (Community is free) | learning Kotlin and backend development |
| Android Studio | Android apps (Kotlin is built in) |
| Kotlin Playground (play.kotlinlang.org) | quick experiments in the browser, no install |
Command-line compiler kotlinc | understanding how compiling works |
Kotlin needs a JDK (Java Development Kit) because it runs on the JVM. JDK 17 or 21 is a good choice.
IntelliJ IDEA Steps
- Install a JDK (for example Temurin 21) and IntelliJ IDEA Community.
- Choose New Project → Kotlin, build system Gradle (Kotlin DSL), JDK 21.
- Open
src/main/kotlin/Main.kt. - Click the green ▶ next to
fun main()to run it.
Command Line
Compile and Run
Save the code as hello.kt, compile it into a runnable jar and run it with Java:
kotlinc hello.kt -include-runtime -d hello.jar
java -jar hello.jarExample output
Welcome to Careeroza Kotlin!
Example
This is the hello.kt file used above.
fun main() {
println("Welcome to Careeroza Kotlin!")
}Output
Welcome to Careeroza Kotlin!