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 though.
Below is how it is happening when I type println("Hello, world!")
at console:
$ scala Welcome to Scala 2.11.12 (OpenJDK 64-Bit Server VM, Java 1.8.0_162). Type in expressions for evaluation. Or try :help. scala> Hello, world! scala>
Any ideas on how we can get through?
We can start Scala REPL by typing scala command in console/terminal. Let's understand how we can add two variable using Scala REPL. In first line we initialized two variable in Scala REPL. Then Scala REPL printed these.
To run Scala from the command-line, download the binaries and unpack the archive. Start the Scala interpreter (aka the “REPL”) by launching scala from where it was unarchived. Start the Scala compiler by launching scalac from where it was unarchived.
Implementing it wouldn't be hard, either! I believe Ctrl + L should be able to clear the REPL console.
The Scala REPL is a tool (scala) for evaluating expressions in Scala. The scala command will execute a source script by wrapping it in a template and then compiling and executing the resulting program.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With