title: Scala SBT: scala.tools.nsc isn't running
body: <p>I have a problem with <strong>scala.tools.sbt</strong></p>
  
  <p><strong>scala file</strong></p>
  
  <p>Here I used parser functionality to make abstract syntax tree of code <code>2 + 3</code></p>
  
  <pre><code>import scala.tools.nsc._
  object Main extends App {
      var i = new Interpreter
      println(i.parse("2 + 3"))
  }
  </code></pre>
  
  <p><strong>SBT configuration</strong></p>
  
  <pre><code>name := "scalaSample"
  
  version := "1.0-SNAPSHOT"
  
  scalaVersion := "2.9.1"
  
  libraryDependencies += "org.scalatest" %% "scalatest" % "1.7.1" % "test"
  
  libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.9.1"
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <blockquote>
    <p>Failed to initialize compiler: object scala not found.
    ** Note that as of 2.8 scala does not assume use of the java classpath.
    ** For the old behavior pass -usejavacp to scala, or if using a Settings
    ** object programatically, settings.usejavacp.value = true.</p>
    
    <p>[error] (run-main) java.lang.NullPointerException
    java.lang.NullPointerException    at
    scala.tools.nsc.CompilationUnits$CompilationUnit.
    (CompilationUnits.scala:16)   at
    scala.tools.nsc.interpreter.ExprTyper$codeParser$.applyRule(ExprTyper.scala:22)
      at
    scala.tools.nsc.interpreter.ExprTyper$codeParser$.stmts(ExprTyper.scala:36)
      at
    scala.tools.nsc.interpreter.ExprTyper$$anonfun$parse$2.apply(ExprTyper.scala:47)
      at
    scala.tools.nsc.interpreter.ExprTyper$$anonfun$parse$2.apply(ExprTyper.scala:46)
      at
    scala.tools.nsc.reporters.Reporter.withIncompleteHandler(Reporter.scala:46)
      at
    scala.tools.nsc.interpreter.ExprTyper$class.parse(ExprTyper.scala:46)
      at
    scala.tools.nsc.interpreter.IMain$exprTyper$.parse(IMain.scala:1012)
      at scala.tools.nsc.interpreter.IMain.parse(IMain.scala:1013)    at
    eu.semantiq.scalaToJS.Main$delayedInit$body.apply(Main.scala:7)   at
    scala.Function0$class.apply$mcV$sp(Function0.scala:34)    at
    scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
      at scala.App$$anonfun$main$1.apply(App.scala:60)    at
    scala.App$$anonfun$main$1.apply(App.scala:60)     at
    scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
      at scala.collection.immutable.List.foreach(List.scala:45)   at
    scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:30)
      at scala.App$class.main(App.scala:60)   at
    eu.semantiq.scalaToJS.Main$.main(Main.scala:5)    at
    eu.semantiq.scalaToJS.Main.main(Main.scala)   at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:616)
    java.lang.RuntimeException: Nonzero exit code: 1  at
    scala.sys.package$.error(package.scala:27)</p>
  </blockquote>
  
  <p><strong>In scala REPL everything works</strong></p>
  
  <blockquote>
    <p>Welcome to Scala version 2.9.0.1 (OpenJDK 64-Bit Server VM, Java
    1.6.0_23). Type in expressions to have them evaluated. Type :help for more information.</p>
    
    <p>scala> <strong>import scala.tools.nsc._</strong></p>
    
    <p>import scala.tools.nsc._</p>
    
    <p>scala> <strong>var i = new Interpreter</strong></p>
    
    <p>warning: there were 4 deprecation
    warnings; re-run with -deprecation for details warning: there were 1
    deprecation warnings; re-run with -deprecation for details</p>
    
    <p>i: scala.tools.nsc.Interpreter = scala.tools.nsc.Interpreter@786bfd73</p>
    
    <p>scala> <strong>println(i.parse("2 + 3"))</strong></p>
    
    <p><strong>Some(List(2.$plus(3)))</strong></p>
  </blockquote>
  
  <p>I feel really sorry for my bad English</p>