How to Install Scala, SBT and Java on Ubuntu 18.04 LTS Linux


In this Post we will see  How to Install Scala, SBT and Java on Ubuntu 18.04  LTS (Linux)

Install Java

Step 1 – Add the PPA

 $ sudo add-apt-repository ppa:webupd8team/java

Step 2 – Update and install the installer script

$ sudo apt update
$ sudo apt install oracle-java8-installer

Step 3 – Set Java environment variables and Oracle JDK8 as default

$ sudo apt install oracle-java8-set-default

Step 4 – Check Java compiler version

$ javac -version

Step 5 – Set environment

$ echo "export PATH=/usr/local/anaconda2/bin:$PATH" >> /etc/bash.bashrc
$ echo "export JAVA_HOME=/usr/lib/jvm/java-8-oracle/" >> /etc/bash.bashrc
$ echo "export PATH=$PATH:$JAVA_HOME/bin" >> /etc/bash.bashrc

Install Scala 2.11.8

$ sudo apt-get remove scala-library scala
$ sudo wget
$ sudo dpkg -i scala-2.11.8.deb

Check Scala version

$ scala -version

Install SBT (Scala Build tool)

SBT (Scala Build Tool, formerly Simple Build Tool) is an open source build tool for Scala and Java projects, similar to Java’s Maven and Ant. SBT is a modern build tool. While it is written in Scala and provides many Scala conveniences, it is a general purpose build tool. sbt is the de facto build tool in the Scala.

$ echo "deb /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
$ sudo apt-key adv --keyserver hkp:// --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
$ sudo apt-get update
$ sudo apt-get install sbt

Apache Spark and Scala Certification Training

How to Install Scala and SBT on Ubuntu 18.04

Partner Sites


  1. user@laptop:~/projects$ echo "export PATH=/usr/local/anaconda2/bin:$PATH" >> /etc/bash.bashrc
    bash: /etc/bash.bashrc: Permission denied
    ser@laptop:~/projects/api$ sudo echo "export PATH=/usr/local/anaconda2/bin:$PATH" >> /etc/bash.bashrc
    bash: /etc/bash.bashrc: Permission denied

    • Run it as administrative user. “that is, log in your administrative account with your password before running the codes”

Leave a Reply

Your email address will not be published.