S
S
SuperZombie2021-03-19 18:19:48
Scala
SuperZombie, 2021-03-19 18:19:48

How to start sbt console?

Good afternoon. Using the sbt runcode scala runs successfully, but when you try to open the interpreter, it throws the following error:

Show
D:\Scala>sbt console
[info] welcome to sbt 1.4.8 (Oracle Corporation Java 1.8.0_281)
[info] loading project definition from D:\Scala\project
[info] set current project to scala (in build file:/D:/Scala/)
[info] Starting scala interpreter...
Welcome to Scala 2.12.12 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_281).
Type in expressions for evaluation. Or try :help.
[error] (Thread-6) java.lang.NoClassDefFoundError: org/fusesource/jansi/AnsiOutputStream
[error] java.lang.NoClassDefFoundError: org/fusesource/jansi/AnsiOutputStream
[error]         at jline.internal.Ansi.stripAnsi(Ansi.java:29)
[error]         at jline.console.ConsoleReader.setPrompt(ConsoleReader.java:528)
[error]         at jline.console.ConsoleReader.readLine(ConsoleReader.java:2454)
[error]         at jline.console.ConsoleReader.readLine(ConsoleReader.java:2407)
[error]         at jline.console.ConsoleReader.readLine(ConsoleReader.java:2395)
[error]         at scala.tools.nsc.interpreter.jline.InteractiveReader.readOneLine(JLineReader.scala:63)
[error]         at scala.tools.nsc.interpreter.InteractiveReader.readLine(InteractiveReader.scala:45)
[error]         at scala.tools.nsc.interpreter.InteractiveReader.readLine$(InteractiveReader.scala:42)
[error]         at scala.tools.nsc.interpreter.jline.InteractiveReader.readLine(JLineReader.scala:31)
[error]         at scala.tools.nsc.interpreter.SplashReader.readLine(InteractiveReader.scala:154)
[error]         at scala.tools.nsc.interpreter.SplashLoop.run(InteractiveReader.scala:82)

Failed to initialize compiler: NoClassDefFoundError.
This is most often remedied by a full clean and recompile.
Otherwise, your classpath may continue bytecode compiled by
different and incompatible versions of scala.
[error]         at java.lang.Thread.run(Unknown Source)

[error] Caused by: java.lang.ClassNotFoundException: org.fusesource.jansi.AnsiOutputStream
java.lang.NoClassDefFoundError: org/fusesource/jansi/AnsiOutputStream[error]    at java.net.URLClassLoader.findClass(Unknown Source)

[error]         at java.lang.ClassLoader.loadClass(Unknown Source)
        at jline.internal.Ansi.stripAnsi(Ansi.java:29)[error]   at java.lang.ClassLoader.loadClass(Unknown Source)

[error]         at jline.internal.Ansi.stripAnsi(Ansi.java:29)
        at jline.console.ConsoleReader.setPrompt(ConsoleReader.java:528)[error]         at jline.console.ConsoleReader.setPrompt(ConsoleReader.java:528)

[error]         at jline.console.ConsoleReader.readLine(ConsoleReader.java:2454)
        at jline.console.ConsoleReader.readLine(ConsoleReader.java:2454)[error]         at jline.console.ConsoleReader.readLine(ConsoleReader.java:2407)

[error]         at jline.console.ConsoleReader.readLine(ConsoleReader.java:2395)
        at jline.console.ConsoleReader.readLine(ConsoleReader.java:2407)[error]         at scala.tools.nsc.interpreter.jline.InteractiveReader.readOneLine(JLineReader.scala:63)

[error]         at scala.tools.nsc.interpreter.InteractiveReader.readLine(InteractiveReader.scala:45)
        at jline.console.ConsoleReader.readLine(ConsoleReader.java:2395)[error]         at scala.tools.nsc.interpreter.InteractiveReader.readLine$(InteractiveReader.scala:42)

[error]         at scala.tools.nsc.interpreter.jline.InteractiveReader.readLine(JLineReader.scala:31)
        at scala.tools.nsc.interpreter.jline.InteractiveReader.readOneLine(JLineReader.scala:63)[error]         at scala.tools.nsc.interpreter.SplashReader.readLine(InteractiveReader.scala:154)

[error]         at scala.tools.nsc.interpreter.SplashLoop.run(InteractiveReader.scala:82)
        at scala.tools.nsc.interpreter.InteractiveReader.readLine(InteractiveReader.scala:45)[error]    at java.lang.Thread.run(Unknown Source)

        at scala.tools.nsc.interpreter.InteractiveReader.readLine$(InteractiveReader.scala:42)
        at scala.tools.nsc.interpreter.jline.InteractiveReader.readLine(JLineReader.scala:31)
        at scala.tools.nsc.interpreter.ILoop.readOneLine(ILoop.scala:444)
        at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:456)
        at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:1048)
        at xsbt.ConsoleBridge.run(ConsoleBridge.scala:75)
        at sbt.internal.inc.AnalyzingCompiler.console(AnalyzingCompiler.scala:209)
        at sbt.Console.console0$1(Console.scala:64)
        at sbt.Console.$anonfun$apply$5(Console.scala:73)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:17)
        at sbt.TrapExit$App.run(TrapExit.scala:258)
        at java.lang.Thread.run(Unknown Source)

[success] Total time: 7 s, completed 19.03.2021 17:17:26

How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-03-19
@sergey-gornostaev

This is a bug in sbt 1.4.8. In earlier and later everything should be fine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question