title: idea sbt java.lang.NoClassDefFoundError: org/apache/spark/SparkConf
body: <p>I'm a beginner of spark.I build an environment use "linux + idea + sbt" ,when I try the quick start of Spark,I get the problem:</p>
  
  <pre><code>    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/SparkConf
      at test$.main(test.scala:11)
      at test.main(test.scala)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
  Caused by: java.lang.ClassNotFoundException: org.apache.spark.SparkConf
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 7 more
  </code></pre>
  
  <p>The versions of them in my disk:</p>
  
  <pre><code>sbt   = 0.13.11
  jdk   = 1.8
  scala = 2.10
  idea  = 2016
  </code></pre>
  
  <p>My directory structure:</p>
  
  <pre><code>test/
    idea/
    out/
    project/
      build.properties    
      plugins.sbt
    src/
      main/
        java/
        resources/
        scala/
        scala-2.10/
          test.scala
    target/
    assembly.sbt
    build.sbt
  </code></pre>
  
  <p>In build.properties:</p>
  
  <pre><code>sbt.version = 0.13.8
  </code></pre>
  
  <p>In plugins.sbt:</p>
  
  <pre><code>logLevel := Level.Warn
  
  addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")
  
  addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2")
  </code></pre>
  
  <p>In build.sbt:</p>
  
  <pre><code>import sbt._
  import Keys._
  import sbtassembly.Plugin._
  import AssemblyKeys._
  
  name := "test"
  
  version := "1.0"
  
  scalaVersion := "2.10.4"
  
  libraryDependencies += "org.apache.spark" % "spark-core_2.10" % "1.6.1" % "provided"
  </code></pre>
  
  <p>In assembly.sbt:</p>
  
  <pre><code>import AssemblyKeys._ // put this at the top of the file
  
  assemblySettings
  </code></pre>
  
  <p>In test.scala:</p>
  
  <pre><code>import org.apache.spark.SparkContext
  import org.apache.spark.SparkContext._
  import org.apache.spark.SparkConf
  
  object test {
    def main(args: Array[String]) {
      val logFile = "/opt/spark-1.6.1-bin-hadoop2.6/README.md" // Should be some file on your system
      val conf = new SparkConf().setAppName("Test Application")
      val sc = new SparkContext(conf)
      val logData = sc.textFile(logFile, 2).cache()
      val numAs = logData.filter(line =&gt; line.contains("a")).count()
      val numBs = logData.filter(line =&gt; line.contains("b")).count()
      println("Lines with a: %s, Lines with b: %s".format(numAs, numBs))
    }
  }
  </code></pre>
  
  <p>How can I solve this problem.</p>