title: using Kotlin with Gradle
body: <p>I'm new to <code>Kotlin</code> and <code>Gradle</code>, and tried to follow <a href="https://kotlinlang.org/docs/reference/using-gradle.html#configuring-dependencies" rel="nofollow noreferrer">these</a> steps, so I got the following 2 files:</p>
  
  <p>after running <code>gradle init</code> I changed the <code>build.gradle</code> to be:</p>
  
  <pre><code>// set up the kotlin-gradle plugin
  buildscript {
      ext.kotlin_version = '1.1.2-2'
  
      repositories {
          mavenCentral()
      }
  
      dependencies {
          classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
      }
  }
  
  // apply the kotlin-gradle plugin
  apply plugin: "kotlin"
  apply plugin: 'application'
  
  mainClassName = "hello.main"
  
  // add kotlin-stdlib dependencies.
  repositories {
      mavenCentral()
  }
  
  dependencies {
      compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  }
  </code></pre>
  
  <p><code>Hello.kt</code>:</p>
  
  <pre><code>package hello   
  
  fun main(args: Array&lt;String&gt;) {   
     println("Hello World!")        
  }
  </code></pre>
  
  <p>Then I run the <code>gradle build</code> and got the <code>build\classes\main\hello\HelloKt.class</code></p>
  
  <p>my question is: Why the file generated is <code>.class</code> not <code>.jar</code> and how to get the <code>.jar</code> file and how to run it, I tried running the generated file using <code>kotlin -classpath HelloKt.class main</code> but got an error <code>error: could not find or load main class hello.main</code></p>