title: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/streaming/StreamingContext
body: <p>It look like the class StreamingContext is not found in the following code.</p>
  <pre><code>import org.apache.spark.streaming.{Seconds, StreamingContext}
  import org.apache.spark.{SparkConf, SparkContext}
  object Exemple {
    def main(args: Array[String]): Unit = {
      val conf = new SparkConf().setMaster(&quot;local[*]&quot;).setAppName(&quot;Exemple&quot;)
      val sc = new SparkContext(conf)
      val ssc = new StreamingContext(sc, Seconds(2)) //this line throws error
  
    }
  }
  </code></pre>
  <p>here is the error:</p>
  <pre><code>Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: org/apache/spark/streaming/StreamingContext
      at Exemple$.main(Exemple.scala:16)
      at Exemple.main(Exemple.scala)
  Caused by: java.lang.ClassNotFoundException: org.apache.spark.streaming.StreamingContext
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 2 more
  
  Process finished with exit code 1
  </code></pre>
  <p>I use the following build.sbt file:</p>
  <pre><code>name := &quot;exemple&quot;
  
  version := &quot;1.0.0&quot;
  
  scalaVersion := &quot;2.11.11&quot;
  
  // https://mvnrepository.com/artifact/org.apache.spark/spark-sql
  libraryDependencies += &quot;org.apache.spark&quot; %% &quot;spark-sql&quot; % &quot;2.2.0&quot;
  // https://mvnrepository.com/artifact/org.apache.spark/spark-streaming
  libraryDependencies += &quot;org.apache.spark&quot; %% &quot;spark-streaming&quot; % &quot;2.2.0&quot; % &quot;provided&quot;
  // https://mvnrepository.com/artifact/org.apache.spark/spark-streaming-kafka-0-10
  libraryDependencies += &quot;org.apache.spark&quot; %% &quot;spark-streaming-kafka-0-10&quot; % &quot;2.2.0&quot;
  </code></pre>
  <p>I run the Exemple class using intellij Run button and I get the error. in sbt shell it work fine. into my dependecies'module, I can find spark dependencies. The code compile in intellij. And I can see in the External Libraries spark dependies (inside the left project panel).
  Do you have any idea. It seem not complicated.</p>
  <p><a href="https://i.stack.imgur.com/90y3y.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/90y3y.jpg" alt="enter image description here" /></a></p>