Getting a Scala interpreter to work

前端 未结 8 941
轻奢々
轻奢々 2020-12-24 05:19

I\'m very new to Scala. I have downloaded it, got it working in Eclipse where I\'ll be developing it; but I can\'t make it work in Terminal.

All sites and books say

8条回答
  •  盖世英雄少女心
    2020-12-24 05:54

    My way of making Scala run every time you type "scala" in Terminal was to add the path not to the .bashrc file but to the /etc/paths one.

    1. Download the latest Scala binary from www.scala-lang.org/download
    2. Unzip the binary file
    3. Move the unzipped folder (named scala-2.11.2) to the /usr/bin/ or some other directory of your preference.
    4. Then open the /etc/paths file with nano:

      sudo nano /etc/paths
      
    5. and add this line to the end:

      /usr/bin/scala-2.11.2/bin
      
    6. Press Ctrl+X to exit nano and answer "Yes" when prompted to overwrite the file

    7. Then restart Terminal and once you type:

      scala
      

      you will get the scala command line that looks like this:

      Welcome to Scala version 2.11.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_05).
      Type in expressions to have them evaluated.
      Type :help for more information.
      
      scala> 
      

    I hope this helps.

提交回复
热议问题