-3

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.

4
  • 2
    The command says /usr/local/src/scala/nano .bashrc with a space in between, the error says usr/local/src/scala/nano.bashrc without a space. Please double check the commands you ran and the manual you're using.
    – muru
    Jul 29, 2018 at 9:10
  • i've run the command without space but it still shows the same error. Jul 29, 2018 at 9:13
  • @KashfUlHUdha FYI `scala is packaged on all supported Ubuntu versions. On 14.04 LTS you will get 2.9, on newer versions - you get 2.11. It is unclear why you self-extracted non-supported later installation....
    – N0rbert
    Jul 29, 2018 at 11:01
  • 2
    BTW, adding . .bashrc to .bashrc is a bad idea. You won't be able to use Bash on your account if you do that, until you remove it that line!
    – Zanna
    Jul 29, 2018 at 20:42

1 Answer 1

3

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
3
  • 1
    Thank u this issue is solved. now .bashrc file is opened. Jul 29, 2018 at 9:39
  • 1
    I've already installed jdk. Jul 29, 2018 at 9:40
  • Can u plz tell me how to add those variables in .bashrc file??? Jul 29, 2018 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.