title: Gradle Project: java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
body: <p>I'm working on a Java project and within this project I did my first try with Kotlin. I started converting some classes to Kotlin with the JavaToKoltin converter provided in the Intellij Idea. Among others my custom exceptions are now converted to Kotlin. But with this the exception handling does not work correct anymore.<br>
  If I throw one of my custom exceptions (e.g. <code>MyCustomKotlinException.kt</code>) within the java code, the exception is not catched (see code below).</p>
  
  <pre><code>// Example.java
  package foo    
  
  import java.util.*;
  import java.lang.*;
  import java.io.*;
  import foo.MyCustomKotlinException;
  
  class Example
  {
      public static void main (String[] args)
      {
          try {
              // Do some stuff
              // if Error
              MyCustomKotlinException e = new MyCustomKotlinException("Error Message");
              throw e;
          } catch (MyCustomKotlinException e) {  // &lt;-- THIS PART IS NEVER REACHED
              // Handle Exception
          } catch (Throwable e) {
              e.printStackTrace(); &lt;-- This is catched
          } finally {
              // Finally ...
          }
      }
  }
  </code></pre>
  
  <p>So can anyone explain to me why the exception is not catch. <code>MyCustomKotlinException</code> is inheriting from Kotlins <code>RuntimeException</code>, which is just an alias to <code>java.lang.RuntimeException</code>.</p>
  
  <pre><code>// MyCustomKotlinException.kt
  package foo
  
  class MyCustomKotlinException(err: String) : RuntimeException(err)
  </code></pre>
  
  <p><strong>Update:</strong><br>
  I split the throw part into 2 lines (instance creation and throwing) and found that the problem is not the throwing. The try block is left after the instance creation. Is anything wrong with my instance creation of this Kotlin class?</p>
  
  <p><strong>Update2:</strong><br>
  I added a second catch block with <code>Throwable</code> and the following Throwable is caught.</p>
  
  <pre><code>java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
  ...
  Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics
  </code></pre>
  
  <p><strong>Update3:</strong><br>
  Changed the title to correct error and fixed problem with adding all project files to jar (see answer below).
  Adding the Kotlin runtime lib to gradle does not work for me.</p>