# How to run my first kotlin "Hello world"

**URL:** <https://discuss.kotlinlang.org/t/how-to-run-my-first-kotlin-hello-world/27296>\
**Category:** Uncategorized\
**Created:** [August 27, 2023, 6:40am UTC](https://discuss.kotlinlang.org/t/how-to-run-my-first-kotlin-hello-world/27296 "2023-08-27T06:40:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anes.pa](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/anes.pa/32/10467_2.png) [@anes.pa](https://discuss.kotlinlang.org/u/anes.pa)\
**Post date:** [August 27, 2023, 6:40am UTC](https://discuss.kotlinlang.org/t/how-to-run-my-first-kotlin-hello-world/27296/1 "2023-08-27T06:40:05Z")

</div>

Dear Friends,  
Today is my first day in Kotlin study. I installed kotlin compiler and try to run my first code

```auto
fun main()
{
  println("First Program")
}

```

I created my jar file using command

D:\Kotlinplay\>kotlinc First.kt -include-runtime -d first.jar

successfully created first.jar file

but when I try to run using command

D:\Kotlinplay\>java -jar first.jar  
no main manifest attribute, in first.jar

How to solve this issue ?

Please advise ASAP.

Thanks  
Anes P A

---

<div class="post-metadata">

**Author:** ![broot](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@broot](https://discuss.kotlinlang.org/u/broot)\
**Post date:** [August 27, 2023, 7:06am UTC](https://discuss.kotlinlang.org/t/how-to-run-my-first-kotlin-hello-world/27296/2 "2023-08-27T07:06:24Z")

</div>

If this is your first day in Kotlin and you don’t have experience with Java as well (your problem is more really about the Java, not Kotlin), then I suggest you to use a proper IDE like IntelliJ and it will do this for you. Running compilers and executing manually is a kind of advanced usage, it requires some additional knowledge.

Short answer is to run this instead:

`java -cp first.jar FirstKt`

But still, I think IDE will be much easier for you. Alternatively, create a very basic gradle build script.

---

<div class="post-metadata">

**Author:** ![anes.pa](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/anes.pa/32/10467_2.png) [@anes.pa](https://discuss.kotlinlang.org/u/anes.pa)\
**Post date:** [August 27, 2023, 7:20am UTC](https://discuss.kotlinlang.org/t/how-to-run-my-first-kotlin-hello-world/27296/3 "2023-08-27T07:20:16Z")

</div>

Thanks @broot  
but when I run  
D:\Kotlinplay\>java -cp first.jar FirstKt

> Error: Main method not found in class FirstKt, please define the main method as:  
> public static void main(String args)  
> or a JavaFX application class must extend javafx.application.Application

Please tell how to solve.

Thanks  
Anes P A

---

<div class="post-metadata">

**Author:** ![broot](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@broot](https://discuss.kotlinlang.org/u/broot)\
**Post date:** [August 27, 2023, 7:25am UTC](https://discuss.kotlinlang.org/t/how-to-run-my-first-kotlin-hello-world/27296/4 "2023-08-27T07:25:26Z")

</div>

You can try to use this instead:

```kotlin
fun main(args: Array<String>) {

```

But I think that shouldn’t be required.

---

<div class="post-metadata">

**Author:** ![anes.pa](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/anes.pa/32/10467_2.png) [@anes.pa](https://discuss.kotlinlang.org/u/anes.pa)\
**Post date:** [August 27, 2023, 7:28am UTC](https://discuss.kotlinlang.org/t/how-to-run-my-first-kotlin-hello-world/27296/5 "2023-08-27T07:28:40Z")

</div>

Thanks alor dear @broot  
Your advise works  
now code is

```auto
fun main(args: Array<String>)
{
  println("First Program help by Broot")
}

```

Thanks

Anes P A
