Notification texts go here Contact Us Buy Now!

sbt not found on ubuntu

Resolving "sbt not found" Error on Ubuntu


Introduction

sbt (Simple Build Tool) is a widely used build tool for Scala projects. When trying to use sbt on Ubuntu, you may encounter an error message indicating that sbt is not found. This can be caused by several factors, including an incorrect installation or missing dependencies.


Solution

  1. Update Certificates:
    sudo update-ca-certificates -f
    sudo /var/lib/dpkg/info/ca-certificates-java.postinst configure
    
  2. This command updates the system's certificate authority (CA) certificates and configures Java-related certificates.


  3. Install Required Packages:
    echo "java installation ok"
    echo "starting sbt installation"
    apt-get install -y apt-transport-https
    

    This command installs the necessary packages, including apt-transport-https, for managing HTTPS-based repositories.


  4. Add sbt Repository:
    echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
    

    This command adds the sbt repository to your system's list of software sources.


  5. Import sbt Key:
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
    

    This command imports the sbt key, which is used to verify the authenticity of packages from the sbt repository.


  6. Update and Install sbt:
    apt-get update
    apt-get install -y sbt
    

    Finally, update the package list and install sbt on your system.


Alternative Solution

If the above steps do not resolve the issue, you can try the following:

  1. Add sbt Repository (Alternative):
    echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
    echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
    
  2. This command adds an alternative sbt repository to your system.


  3. Import sbt Key (Alternative):
    curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
    

    This command imports the alternative sbt key.


  4. Update and Install sbt:
    sudo apt-get update
    sudo apt-get install sbt
    

    Finally, update the package list and install sbt.


Conclusion

Following the steps outlined in this guide should resolve the "sbt not found" error on Ubuntu. Remember to choose the solution that best suits your needs and preferences. Once sbt is successfully installed, you can leverage its powerful features to build and manage Scala projects efficiently.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.