Why is console always in error ?

no matter what i do in a console, i get an error...




here is loading a file:

scala> :load c:/`playspace/FirstScala/first.scala

Loading c:\`playspace\FirstScala\first.scala...

x: Int = 4

<script>:3: error: value tools is not a member of package scala

  var value: scala.tools.nsc.InterpreterSettings = _

                   ^

<script>:4: error: value tools is not a member of package scala

  def set(x: Any) = value = x.asInstanceOf[scala.tools.nsc.InterpreterSettings]

                                                 ^

Exception in thread "main" java.util.NoSuchElementException: None.get

 at scala.None$.get(Option.scala:262)

 at scala.None$.get(Option.scala:260)

 at scala.tools.nsc.Interpreter.bind(Interpreter.scala:624)

 at scala.tools.nsc.Interpreter$$anonfun$quietBind$1.apply(Interpreter.scala:632)

 at scala.tools.nsc.Interpreter$$anonfun$quietBind$1.apply(Interpreter.scala:632)

 at scala.tools.nsc.Interpreter$$anonfun$beQuietDuring$2.apply(Interpreter.scala:171)

 at scala.util.control.Exception$Catch.apply(Exception.scala:79)

 at scala.tools.nsc.Interpreter.beQuietDuring(Interpreter.scala:169)

 at scala.tools.nsc.Interpreter.quietBind(Interpreter.scala:632)

 at scala.tools.nsc.Interpreter.recordRequest(Interpreter.scala:278)

 at scala.tools.nsc.Interpreter.loadAndRunReq$1(Interpreter.scala:586)

 at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:599)

 at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:577)

 at scala.tools.nsc.InterpreterLoop.reallyInterpret$1(InterpreterLoop.scala:472)

 at scala.tools.nsc.InterpreterLoop.interpretStartingWith(InterpreterLoop.scala:515)

 at scala.tools.nsc.InterpreterLoop.command(InterpreterLoop.scala:362)

 at scala.tools.nsc.InterpreterLoop.processLine$1(InterpreterLoop.scala:243)

 at scala.tools.nsc.InterpreterLoop.repl(InterpreterLoop.scala:249)

 at scala.tools.nsc.InterpreterLoop$$anonfun$interpretAllFrom$1.apply(InterpreterLoop.scala:260)

 at scala.tools.nsc.InterpreterLoop$$anonfun$interpretAllFrom$1.apply(InterpreterLoop.scala:257)

 at scala.tools.nsc.io.Streamable$Chars$class.applyReader(Streamable.scala:100)

 at scala.tools.nsc.io.File.applyReader(File.scala:62)

 at scala.tools.nsc.InterpreterLoop.interpretAllFrom(InterpreterLoop.scala:257)

 at scala.tools.nsc.InterpreterLoop$$anonfun$load$1.apply(InterpreterLoop.scala:303)

 at scala.tools.nsc.InterpreterLoop$$anonfun$load$1.apply(InterpreterLoop.scala:302)

 at scala.tools.nsc.InterpreterLoop.withFile(InterpreterLoop.scala:296)

 at scala.tools.nsc.InterpreterLoop.load(InterpreterLoop.scala:302)

 at scala.tools.nsc.InterpreterLoop$$anonfun$7.apply(InterpreterLoop.scala:204)

 at scala.tools.nsc.InterpreterLoop$$anonfun$7.apply(InterpreterLoop.scala:204)

 at scala.tools.nsc.InterpreterControl$OneArg.apply(InterpreterLoop.scala:53)

 at scala.tools.nsc.InterpreterControl$OneArg.apply(InterpreterLoop.scala:50)

 at scala.tools.nsc.InterpreterLoop.command(InterpreterLoop.scala:373)

 at scala.tools.nsc.InterpreterLoop.processLine$1(InterpreterLoop.scala:243)

 at scala.tools.nsc.InterpreterLoop.repl(InterpreterLoop.scala:249)

 at scala.tools.nsc.InterpreterLoop.main(InterpreterLoop.scala:559)

 at scala.tools.nsc.InterpreterLoop.main(InterpreterLoop.scala:610)

 at org.jetbrains.plugins.scala.compiler.rt.ConsoleRunner.main(ConsoleRunner.java:33)

 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

 at java.lang.reflect.Method.invoke(Method.java:597)

 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)


Process finished with exit code 1


something else:


scala> val x = 5
x: Int = 5
<script>:3: error: value tools is not a member of package scala
  var value: scala.tools.nsc.InterpreterSettings = _
                   ^
<script>:4: error: value tools is not a member of package scala
  def set(x: Any) = value = x.asInstanceOf[scala.tools.nsc.InterpreterSettings]
                                                 ^
Exception in thread "main" java.util.NoSuchElementException: None.get
 at scala.None$.get(Option.scala:262)
 at scala.None$.get(Option.scala:260)
 at scala.tools.nsc.Interpreter.bind(Interpreter.scala:624)
 at scala.tools.nsc.Interpreter$$anonfun$quietBind$1.apply(Interpreter.scala:632)
 at scala.tools.nsc.Interpreter$$anonfun$quietBind$1.apply(Interpreter.scala:632)
 at scala.tools.nsc.Interpreter$$anonfun$beQuietDuring$2.apply(Interpreter.scala:171)
 at scala.util.control.Exception$Catch.apply(Exception.scala:79)
 at scala.tools.nsc.Interpreter.beQuietDuring(Interpreter.scala:169)
 at scala.tools.nsc.Interpreter.quietBind(Interpreter.scala:632)
 at scala.tools.nsc.Interpreter.recordRequest(Interpreter.scala:278)
 at scala.tools.nsc.Interpreter.loadAndRunReq$1(Interpreter.scala:586)
 at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:599)
 at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:577)
 at scala.tools.nsc.InterpreterLoop.reallyInterpret$1(InterpreterLoop.scala:472)
 at scala.tools.nsc.InterpreterLoop.interpretStartingWith(InterpreterLoop.scala:515)
 at scala.tools.nsc.InterpreterLoop.command(InterpreterLoop.scala:362)
 at scala.tools.nsc.InterpreterLoop.processLine$1(InterpreterLoop.scala:243)
 at scala.tools.nsc.InterpreterLoop.repl(InterpreterLoop.scala:249)
 at scala.tools.nsc.InterpreterLoop.main(InterpreterLoop.scala:559)
 at scala.tools.nsc.InterpreterLoop.main(InterpreterLoop.scala:610)
 at org.jetbrains.plugins.scala.compiler.rt.ConsoleRunner.main(ConsoleRunner.java:33)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)

Process finished with exit code 1



this is what the console says when it starts:

"C:\Program Files\Java\jdk1.6.0_05\bin\java" -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 10.0.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\`development\scala\lib\scala-compiler.jar;C:\`development\scala\lib\scala-library.jar;C:\Documents and Settings\alex.repede\.IntelliJIdea10\config\plugins\Scala\lib\scala-plugin-runners.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 10.0.1\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.jetbrains.plugins.scala.compiler.rt.ConsoleRunner -classpath "C:/Program Files/Java/jdk1.6.0_05/jre/lib/ext/localedata.jar;C:/Program Files/Java/jdk1.6.0_05/jre/lib/management-agent.jar;C:/Program Files/Java/jdk1.6.0_05/jre/lib/plugin.jar;C:/Program Files/Java/jdk1.6.0_05/jre/lib/resources.jar;C:/`development/scala/lib/scala-swing.jar;C:/Program Files/Java/jdk1.6.0_05/jre/lib/ext/sunmscapi.jar;C:/Program Files/Java/jdk1.6.0_05/jre/lib/deploy.jar;C:/Program Files/Java/jdk1.6.0_05/jre/lib/jsse.jar;C:/`development/scala/lib/scala-dbc.jar;C:/Program Files/Java/jdk1.6.0_05/jre/lib/ext/dnsns.jar;C:/`development/scala/lib/scala-library.jar;C:/Program Files/Java/jdk1.6.0_05/jre/lib/ext/sunpkcs11.jar;C:/Program Files/Java/jdk1.6.0_05/jre/lib/javaws.jar;C:/Program Files/Java/jdk1.6.0_05/jre/lib/jce.jar;C:/Program Files/Java/jdk1.6.0_05/jre/lib/rt.jar;C:/Program Files/Java/jdk1.6.0_05/jre/lib/ext/sunjce_provider.jar;C:/Program Files/Java/jdk1.6.0_05/jre/lib/charsets.jar;"

Welcome to Scala version 2.8.1.final (Java HotSpot(TM) Client VM, Java 1.6.0_05).

Type in expressions to have them evaluated.

Type :help for more information.


what do i keep getting these errors ? isn't the console supposed to keep on working ? not just run something and blow...
6 comments
Comment actions Permalink

Looking at your classpath, there looks to be an extra backtick character included at in the scala-library and scala-compiler jars:
C:\`development\scala\lib\scala-compiler.jar;C:\`development\scala\lib\scala-library.jar

Try to update your library definition to remove that.

0
Comment actions Permalink

but i do have a folder named `development ... (with a backstick)   :)

0
Comment actions Permalink

Generally speaking, it's better to avoid using strange characters in library path.

Try to run Scala console without the IDE (from the command line) and check whether the problem persists.

0
Comment actions Permalink

It's broken with scala 2.8.1.final. I'll fix it.

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

As workaround you can attach scala-compiler.jar to your classpath.
From next nightly, when you run console scala-compiler.jar will be attached automatically. (that's strange that scala 2.8.1 needs it for console)

Best regards,
Alexander Podkhalyuizn.

0

Please sign in to leave a comment.