title: Kotlin - IntelliJ Project Setup
body: <p>I want to start a new project with Kotlin for the JVM using the IntelliJ IDE, but I can't get a configuration for it to work.  I was attempting to follow <a href="http://kotlinlang.org/docs/tutorials/getting-started.html" rel="noreferrer">this tutorial</a>, and after that didn't work (the "Run '_DefaultPackage'" option never even showed up), I started trying to intuit what was supposed to be done without success.
  What has happened so far (repeatedly):</p>
  
  <ul>
  <li>I created a new project, selected "Kotlin - JVM" as the project type.</li>
  <li>I clicked the "Create..." button for the Kotlin Runtime on the second page and selected "Copy to: lib".</li>
  <li>I click "Finish" and the project created has one module with same name as my project.  There is no default source file or any configuration.</li>
  <li>I create a Kotlin file named "app.kt" (I've tried other names too, like "Main.kt"), and put the following source code in:</li>
  </ul>
  
  <pre class="lang-kotlin prettyprint-override"><code>fun main(args: Array&lt;String&gt;){
      println("Hello world!")
  }
  </code></pre>
  
  <ul>
  <li>I right clicked on the code editor AND the file in the left pane to find the "Run '_DefaultPackage'" option mentioned in the tutorial, but failed to find it in either.</li>
  <li>I create a new Kotlin configuration, which asks that I put in a "Main class".  Seeing this, I change the code to:</li>
  </ul>
  
  <pre class="lang-kotlin prettyprint-override"><code>public class Main {
      fun main(args: Array&lt;String&gt;) {
          println("Hello world!")
      }
  }
  </code></pre>
  
  <ul>
  <li>I edit my configuration and set the main class to "Main", and then run the configuration.  It fails with this error: "Error running : Function 'main' not found in class 'Main'.</li>
  </ul>
  
  <p>What am I missing?</p>