# Function main not found in class Main

**URL:** <https://discuss.kotlinlang.org/t/function-main-not-found-in-class-main/284>\
**Category:** Uncategorized\
**Created:** [April 14, 2015, 5:27am UTC](https://discuss.kotlinlang.org/t/function-main-not-found-in-class-main/284 "2015-04-14T05:27:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![makerberg](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/makerberg/32/1520_2.png) [@makerberg](https://discuss.kotlinlang.org/u/makerberg)\
**Post date:** [April 14, 2015, 5:27am UTC](https://discuss.kotlinlang.org/t/function-main-not-found-in-class-main/284/1 "2015-04-14T05:27:52Z")

</div>

I'm unable to get beyond this error message trying to make the simplest hello world program work with Kotlin and Gradle on Intellij 14.1.1 and Kotlin 0.11.91.1. I'm using JDK 1.8.0.20 on OSX 10.10.2. Attached screenshots show the code, gradle config and run config.

  
  
 [Screen Shot 2015-04-13 at 10.25.13 PM.png|attachment](upload://xA6FknGFz73PE8QdcDiY0WhCxaa.png) (48.9 KB)  
  
 [Screen Shot 2015-04-13 at 10.22.17 PM.png|attachment](upload://hRr2ji9hTMEEKlsr7Z3s6Lx3JQ1.png) (20 KB)  
  
 [Screen Shot 2015-04-13 at 10.22.40 PM.png|attachment](upload://wyzU7D5xwifH8mKyiBOL18CR9wY.png) (57.6 KB)

---

<div class="post-metadata">

**Author:** ![MarioArias](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/marioarias/32/1488_2.png) [@MarioArias](https://discuss.kotlinlang.org/u/MarioArias)\
**Post date:** [April 14, 2015, 9:35am UTC](https://discuss.kotlinlang.org/t/function-main-not-found-in-class-main/284/2 "2015-04-14T09:35:47Z")

</div>

Change you class for an object and add platformStatic to your main method

```kotlin
object Main {
  platformStatic fun main(args: Array<String>){
    println("Hello kotlin")
  }
}
```

or put your main function outside the class

```kotlin
fun main(args: Array<String>){
    println("Hello kotlin")
}
```

---

<div class="post-metadata">

**Author:** ![makerberg](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/makerberg/32/1520_2.png) [@makerberg](https://discuss.kotlinlang.org/u/makerberg)\
**Post date:** [April 15, 2015, 4:59am UTC](https://discuss.kotlinlang.org/t/function-main-not-found-in-class-main/284/3 "2015-04-15T04:59:37Z")

</div>

Thanks Mario that was the trick!
