Install Scala And Scala Build Tools IN UBUNTU-18.04LTS

How to - install scala,and sbt(scala build tool) on ubuntu 18.04 lts & ubuntu 16.04 lts, and start a hello world project in sbt and shell

Install Scala And Scala Build Tools IN UBUNTU-18.04LTS

So Scala is packed object-oriented and functional programming in one succinct, high-level language. Scala's static types help avoid bugs in complex applications, and its JVM and JavaScript runtimes let you build high-performance systems with easy access to huge ecosystems of libraries.

So what is Sbt ?

So is an open source build tool for scala like ant or maven, where plugins are imported by maven format repositories, which provides features like compiling Scala code and integrating with many Scala test frameworks,Continuous compilation, testing, and deployment,Dependency management etc.!!

This tutorial will help you to install Scala and Sbt(Scala build tool), write a hello world program in shell and create a basic sbt project.

Installing scala build tool

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

Installing Scala

sudo apt-get update
sudo apt-get install scala

Basic Hello world Program in scala shell

  • Lets open scala shell by typing below command
scala
  • We shall print hell world from scala shell
 println("hello World")
  • Quit the The Scala shell
:q

hello world project using Scala build tool

sbt new scala/hello-world.g8

2.provide the name to project when prompted.
3.open the project in suitable Ide
4.run the main.scala function