# Can't start a main class

**URL:** <https://discuss.kotlinlang.org/t/cant-start-a-main-class/1181>\
**Category:** Uncategorized\
**Created:** [May 10, 2012, 4:07am UTC](https://discuss.kotlinlang.org/t/cant-start-a-main-class/1181 "2012-05-10T04:07:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cedricbeust](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/cedricbeust/32/1429_2.png) [@cedricbeust](https://discuss.kotlinlang.org/u/cedricbeust)\
**Post date:** [May 10, 2012, 4:07am UTC](https://discuss.kotlinlang.org/t/cant-start-a-main-class/1181/1 "2012-05-10T04:07:24Z")

</div>

IDEA IU-117.46 Kotlin plug-in: 0.1.2300

[Similar problem as before](https://discuss.kotlinlang.org/t/cant-start-a-main-class/1243) but I can’t solve it this time: I can’t run a simple main class.

The “Run” configuration menu item doesn’t appear when I right click on the class. I tried creating the configuration manually but even after specifying the main class and “Ok”, that configuration never appears under the Kotlin tab of the configurations.

What could I do to investigate this?

 ![/uploads/kotlinlang/original/1X/96a2daa0beccdd9293c67ab0aceb306390e58b62.png](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/1X/96a2daa0beccdd9293c67ab0aceb306390e58b62.png)

 ![/uploads/kotlinlang/original/1X/01f99fbf51d8d44634bba143b30ef7a1d83da088.png](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/1X/01f99fbf51d8d44634bba143b30ef7a1d83da088.png)

After pressing OK:

 ![/uploads/kotlinlang/original/1X/ac1a185dabe94ad1e02080f98f9cf50be4b036ef.png](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/1X/ac1a185dabe94ad1e02080f98f9cf50be4b036ef.png)

---

<div class="post-metadata">

**Author:** ![jstrachan](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/jstrachan/32/1559_2.png) [@jstrachan](https://discuss.kotlinlang.org/u/jstrachan)\
**Post date:** [May 10, 2012, 8:29am UTC](https://discuss.kotlinlang.org/t/cant-start-a-main-class/1181/2 "2012-05-10T08:29:34Z")

</div>

I didn't think the JVM supported main() methods as instance methods? Thought they had to be static (at the bytecode level); so either top level functions, or maybe methods on an object (though I've not tried the latter yet).

---

<div class="post-metadata">

**Author:** ![OliverPlow](https://avatars.discourse-cdn.com/v4/letter/o/d07c76/32.png) [@OliverPlow](https://discuss.kotlinlang.org/u/OliverPlow)\
**Post date:** [May 10, 2012, 9:53am UTC](https://discuss.kotlinlang.org/t/cant-start-a-main-class/1181/3 "2012-05-10T09:53:41Z")

</div>

Kotlin plug-in: 0.1.2300 ?! [http://www.jetbrains.com/kotlin/eap-plugin-repository/updatePlugins.xml](http://www.jetbrains.com/kotlin/eap-plugin-repository/updatePlugins.xml) still points to Kotlin plugin 0.1.209. Am I missing something or is 0.1.2300 a wrong version number?

---

<div class="post-metadata">

**Author:** ![OliverPlow](https://avatars.discourse-cdn.com/v4/letter/o/d07c76/32.png) [@OliverPlow](https://discuss.kotlinlang.org/u/OliverPlow)\
**Post date:** [May 10, 2012, 10:19am UTC](https://discuss.kotlinlang.org/t/cant-start-a-main-class/1181/4 "2012-05-10T10:19:08Z")

</div>

I found Kotlin plug-in 0.1.2300 [here](http://teamcity.jetbrains.com/project.html?projectId=project67&tab=projectOverview). Sorry for bothering...

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [May 10, 2012, 10:21am UTC](https://discuss.kotlinlang.org/t/cant-start-a-main-class/1181/5 "2012-05-10T10:21:21Z")

</div>

Right, a main() function can only be package-level in Kotlin

---

<div class="post-metadata">

**Author:** ![cedricbeust](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/cedricbeust/32/1429_2.png) [@cedricbeust](https://discuss.kotlinlang.org/u/cedricbeust)\
**Post date:** [May 10, 2012, 3:53pm UTC](https://discuss.kotlinlang.org/t/cant-start-a-main-class/1181/6 "2012-05-10T15:53:15Z")

</div>

> Right, a main() function can only be package-level in Kotlin

I did not realize this, thanks Andrey and James.
