1

I installed scala with apt-get install scala. ans figure out another trouble where exactly scala home is now?

this Where is SCALA_HOME on Ubuntu? question suggest:

/usr/share/java

I want to be sure and downloaded and untarred last scala version.

all this I put at /opt/scala and added to system environment.

But now I have default installed version of scala. I don't know how to set version to new location?

Here is how it looks:

nazar@nazar-desktop:~$ scala -version
Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL
nazar@nazar-desktop:~$ echo $SCALA_HOME
/opt/scala/scala-2.10.3

I want to turn installed version from 2.9.2 to untarred one.

  • how to solve this trouble?
Community
  • 1
  • 1
catch23
  • 17,519
  • 42
  • 144
  • 217

3 Answers3

1

If you put $SCALA_HOME/bin at the front of your PATH variable, like this:

export PATH="$SCALA_HOME/bin:$PATH"

that should fix it.

However, you need to type hash -r in each terminal window in which you have tried to run scala, to make the change take effect.

Robin Green
  • 32,079
  • 16
  • 104
  • 187
1

I untarred scala in /usr/local then made scala a symbolic link to scala-2.10.0

The reason for this is to make an upgrade easier, just alter the symlink

Next, I added /usr/local/scala/bin to the PATH in .bashrc

After this, typing scala in a term gives me the prompt

To install scala into eclipse was considerably more complicated but I got that to work too, by untarring stuff into /usr/local

I didn't bother with apt-get on .deb packages as I run Ubuntu LTS and as far as I know there are no ppa that track a current version

Also, this SCALA_HOME thing: there is a function in the shell script "scala" that finds it in this way

findScalaHome () {
  # see SI-2092 and SI-5792
  local source="${BASH_SOURCE[0]}"
  while [ -h "$source" ] ; do
    local linked="$(readlink "$source")"
    local dir="$( cd -P $(dirname "$source") && cd -P $(dirname "$linked") && pw
d )"
    source="$dir/$(basename "$linked")"
  done
  ( cd -P "$(dirname "$source")/.." && pwd )
}
Vorsprung
  • 32,923
  • 5
  • 39
  • 63
1

I personally wouldn't bother.

The binary incompatibilities across major versions mean you'll likely want more than one version available if you ever work on more than one project.

My advice is to install the latest version of SBT and use that to manage versions at a per-project level. You'll still be able to get a REPL via sbt console

Kevin Wright
  • 49,540
  • 9
  • 105
  • 155