Of Code and Me

Somewhere to write down all the stuff I'm going to forget and then need

error: value tools is not a member of package scala when using the scala console in IntelliJ IDEA October 20, 2010

Filed under: Error,IntelliJ,Scala — Rupert Bates @ 3:28 pm

If you get the following error whilst trying to use the scala console in Intellij IDEA:


<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:185)
at scala.None$.get(Option.scala:183)
at scala.tools.nsc.Interpreter.bind(Interpreter.scala:622)
at scala.tools.nsc.Interpreter$$anonfun$quietBind$1.apply(Interpreter.scala:630)
at scala.tools.nsc.Interpreter$$anonfun$quietBind$1.apply(Interpreter.scala:630)
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:630)
at scala.tools.nsc.Interpreter.recordRequest(Interpreter.scala:276)
at scala.tools.nsc.Interpreter.loadAndRunReq$1(Interpreter.scala:584)
at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:597)
at scala.tools.nsc.Interpreter.interpret(Interpreter.scala:575)
at scala.tools.nsc.InterpreterLoop.reallyInterpret$1(InterpreterLoop.scala:471)
at scala.tools.nsc.InterpreterLoop.interpretStartingWith(InterpreterLoop.scala:514)
at scala.tools.nsc.InterpreterLoop.command(InterpreterLoop.scala:361)
at scala.tools.nsc.InterpreterLoop.processLine$1(InterpreterLoop.scala:242)
at scala.tools.nsc.InterpreterLoop.repl(InterpreterLoop.scala:248)
at scala.tools.nsc.InterpreterLoop.main(InterpreterLoop.scala:558)
at scala.tools.nsc.InterpreterLoop.main(InterpreterLoop.scala:609)
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)

You can fix it as follows:

  1. From the ‘Run’ menu click ‘Edit Configurations’
  2. Select the Scala Console run configuration and type -usejavacp in the ‘ConsoleArgs’ box
  3. Click Apply

To make this the default for all Scala ConsoleĀ  run configurations

  1. right click on the top leve Scala Console icon and select ‘Edit Defaults’
  2. Type -usejavacp in the ‘ConsoleArgs’ box
  3. Click Ok

It should now work correctly

Advertisements
 

2 Responses to “error: value tools is not a member of package scala when using the scala console in IntelliJ IDEA”

  1. Timo Meinen Says:

    Thank you very much for sharing this information.

  2. Briggs Says:

    Thanks a lot for posting this. I was truly annoyed with the issue in about 5 minutes of finding it. Now I can move on!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s