TransWikia.com

tar "no such file or directory" error during Scala installation

Ask Ubuntu Asked by Kashf Ul HUdha on March 3, 2021

I followed these steps to download and install scala but faced some issues.

Install Scala

  1. First download scala-2.12.1.tgz from the scala site
  2. Then run the following commands in the terminal

    sudo mkdir /usr/local/src/scala
    sudo tar -xvf sscala-2.12.1 .tgz -C /usr/local/src/scala/nano .bashrc
    

    after that add this variable at the end of opened .bashrc file

    export SCALA_HOME=/usr/local/src/scala/scala-2.12.1
    export PATH=$SCALA_HOME/bin:$PATH
    . .bashrc
    

When I wrote the 2nd command in terminal it showed

tar: usr/local/src/scala/nano.bashrc: cannot open: no such file or directory
tar: Error is not recoverable: existing now.

I need help to resolve this issue.

One Answer

You got the following error:

tar: usr/local/src/scala/nano.bashrc: cannot open: no such file or directory
tar: Error is not recoverable: existing now.

because you didn't extract the contents of scala-2.12.1.tgz because of a typo error. Instead of:

sudo tar -xvf sscala-2.12.1 .tgz -C /usr/local/src/scala/nano .bashrc

The correct commands should be:

sudo mkdir /usr/local/src/scala/  
sudo tar -xvf scala-2.12.1.tgz -C /usr/local/src/scala/  
nano .bashrc

These commands will solve the immediate problem in the question, however it should be noted that according to the official Scala website the most popular way to get Scala is either using Scala through sbt, the Scala build tool, or to use Scala through an IDE. Using Scala through IntelliJ IDE is recommended for beginners who are not familiar with the command line. The free intellij-idea-community snap package can be installed in all currently supported versions of Ubuntu with the following commands:

sudo snap install intellij-idea-community --classic  

In Ubuntu 16.04 and 18.04 the package name of the required Java 8 JDK in the default Ubuntu repositories is openjdk-8-jdk and it can be installed by the following command:

sudo apt install openjdk-8-jdk  

Run the following commands to export the path to SCALA_HOME to the PATH variable.

export SCALA_HOME="/usr/local/src/scala/scala-2.12.1"
export PATH=$SCALA_HOME/bin:$PATH
source ~/.bashrc

Correct answer by karel on March 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP