I am using Ubuntu 18.04 + Scala 2.11.12 (OpenJDK 64-Bit Server VM, Java 1.8.0_162).
Once I open the scala shell, I am not able to see anything that I type. It gets typed
This worked for me!
Ubuntu steps: 1. Go to /usr/share/sbt/bin 2. Open file "sbt" 3. Add "export TERM=xterm-color" right below "#!/bin/sh"
OS X steps: 1. Go to /usr/local/bin/ 2. Open file "sbt" 3. Add "export TERM=xterm-color" right below "#!/bin/sh"
This seems to be an issue with JLine2 being built with JDK9+, but being used on JSK8.
JLine is a Java library for handling console input.
just download and install via dpkg:
https://launchpad.net/~lokkju/+archive/ubuntu/java-compat/+build/16458066/+files/libjline2-java_2.14.6-1ubuntu1~bionicppa1_all.deb
The following thing is working for me.
Open a scala console via sbt.
~$ sbt
[info] Loading project definition from /home/abhay/project
[info] Set current project to abhay (in build file:/home/abhay/)
[warn] sbt server could not start because there's another instance of sbt running on this build.
[warn] Running multiple instances is unsupported
sbt:abhay> console
[info] Starting scala interpreter...
Welcome to Scala 2.12.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_161).
Type in expressions for evaluation. Or try :help.
scala> printf("Hello, Abhay!");
Hello, Abhay!
scala>
This is working for me for now.
I am pretty sure its some environment issue. Anyone else facing something similar?
~Abhay
Install SBT:
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt
Then Type sbt on the command prompt:
Then Type console
Good to go.
Test: type: printf("Hello Scala")
Cheers!!!
scala 2.11.12 as described above throws some error before the REPL is started, which is taken care in scala 2.12.x Instead remove Scala and Install the latest scala package with dpkg
sudo apt-get remove scala-library scala
sudo wget www.scala-lang.org/files/archive/scala-2.12.8.deb
sudo dpkg -i scala-2.12.8.deb
To fix the problem in the current scala repl session run:
import sys.process._
"reset" !
To fix the problem completely removed scala and install it with dpkg (not with apt):
sudo apt-get remove scala-library scala
sudo wget www.scala-lang.org/files/archive/scala-2.11.12.deb
sudo dpkg -i scala-2.11.12.deb