How to install an older version of scala - scala
I currently had installed scala 2.11.7 but in order to fix this issue, I have to install a older version of scala(2.10.5). When I try to install with brew, I keep getting the following error
Error: No available formula for 2.10.5
I tried downloading the binaries for scala download page but when I load the SDK and all the libraries in IntelliJ, I just get this error
Error:scalac: No 'scala-library*.jar' in Scala compiler classpath in Scala SDK scala-sdk-2.10.5
So what is the right way to install an older version of scala and setting the same in intellij
The following should work for Homebrew 0.9.5:
Install Tapped version of Scala 2.10
brew install homebrew/versions/scala210
Unlink version of Scala 2.11 (if installed)
brew unlink scala
Link Tapped version of Scala 2.10
brew link scala210 --force
Check scala version
scala -version
brew search scala
then you will find all the available versions like below
scala scala#2.10 scala#2.11 scalaenv scalariform scalastyle
homebrew/science/scalapack Caskroom/cask/scala-ide
Then choose whichever version you want to install. say if you want to install scala 2.11 then you can do that by runnig the command like below
brew install scala#2.11
If you manage your project with sbt, the scala built tool, either directly or via IntelliJ, the version of scala for that code is defined in the build file (build.sbt or Build.scala):
scalaVersion := "2.10.5"
Choosing this path, there isn't even a need to install scala on your Mac at all. Each project will have its own version -- pulled from your local ivy repository, so it doesn't have to download it each time.
And rather than typing scala to get to the REPL, you type sbt console to get to the REPL with the project's scala version and dependencies loaded.
Homebrew installs scala 2.10.5 with the formula scala210:
$ brew install scala210
==> Installing scala210 from homebrew/homebrew-versions
==> Downloading https://homebrew.bintray.com/bottles/scala210-2.10.5.yosemite.bottle.tar.gz
==> Downloading http://www.scala-lang.org/files/archive/scala-2.10.5.tgz
######################################################################## 100,0%
However, if you are using a build tool like maven or sbt, you should be able to set another scala version in your build config. You should then be able to import your project into IntelliJ and IntelliJ should automatically use the dependencies defined in your build config.
Using brew to install specific version:
$ brew search scala
==> Formulae
scala scala#2.10 scala#2.11 scalaenv
scalapack scalariform scalastyle
==> Casks
scala-ide
Make sure you default version in profile
$echo 'export PATH="/usr/local/opt/scala#2.11/bin:$PATH"' >> ~/.bash_profile
Related
Which version of sbt is compatible with scala 2.13.4
I have scala 2.13.8 and sbt 1.5.8 installed using brew command But i am using scala 2.13.4 in intellij for my project and sbt 1.4.4.I have also installed scala plugin But my project gives unable to fetch project structure from sbt. And thus I'm not able to install any of the dependencies.
SBT fails with `String.class is broken`
sbt fails with a cryptic error on issuing any command (compile, assembly, clean or any other). $ sbt --version error: error while loading String, class file '/modules/java.base/java/lang/String.class' is broken (class java.lang.NullPointerException/null) I am on a machine running macOS, and sbt was installed via homebrew. I have tried upgrading to the latest versions of sbt (1.3.10), but the error still persists.
The issue is documented on the SBT Download page. Homebrew maintainers have added a dependency to JDK 13 because they want to use more brew dependencies (brew#50649). This causes sbt to use JDK 13 even when java available on PATH is JDK 8 or 11. To prevent sbt from running on JDK 13, install jEnv or switch to using SDKMAN. I was able to resolve the problem by using JDK 8 via jEnv.
Since sbt documents JDK 8 and 11 as compatible versions We recommend AdoptOpenJDK JDK 8 or AdoptOpenJDK JDK 11 try controlling which JDK is used by sbt via -java-home setting which can be configured system-wide via sbtopts run configuration /usr/local/etc/sbtopts or per-project basis via <project-root>/.sbtopts For example, to configure JDK used by sbt in current project, try setting in .sbtopts -java-home /Users/picard/.sdkman/candidates/java/current
This is what solved my problem on my Mac. brew uninstall sbt Install sdkman curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh" Install sbt via sdk sdk install sbt
I had the same issue recently. What worked for me is to install SDKMAN(https://sdkman.io/) $ curl -s "https://get.sdkman.io" | bash ... $ source "$HOME/.sdkman/bin/sdkman-init.sh" ... After installation, I wanted to see what versions of Java I can install. So I simply run this command to list all the available versions of Java sdk list java Choose the version you want to install (recommend installing either 8 or 11 as mentioned above) and simply run the command with the identifier that specifies your version from the list sdk install java 11.0.3.hs-adpt After installation, it set the Java 11 to default on my system. I then ran the sbt command again and it worked.
If you are using SDKMAN then in some cases certain versions of Java (i.e. JDK) from different vendor might help. E.g. I was using Amazon Correto JDK8 (version 8.332.08.1-amzn) and it could not properly build my sbt project in IntellIJ IDEA, so I've switched to using Zulu's JDK8 (version 8.0.332-zulu) as default java version. Hope this helps and good luck. :)
sbt installation does not set up scala; cant run scala files
I followed instructions on this site because I didn't want to work with intellij. With this installation, scala is not available as a command. How would I go about running .scala files?
Installing sbt doesn't get scala REPL for you. If you have sbt in your PATH variable, then you can use sbt console command to do and verify simple scala commands. Otherwise you need to install scala separately. The easy way to install scala and sbt is to use sdkman. Follow steps here. curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh" sdk install sbt sdk install scala
Getting rid of old scala version and install 2.11.7
Noob question incoming. I just uninstalled scala 2.9.2 from my machine in doing: sudo apt-get remove scala While the command: scala -version outputs: The program 'scala' is currently not installed. You can install it by typing: sudo apt-get install scala My scala/sbt program still functions... Why? I do not know. I would like to install the latest version of scala which is the 2.11.7. My questions are: - How do I fully uninstall scala? - How do I install scala 2.11.7? (In which directory uncompress the .tgz? What bindings?)
SBT is not scala the command sbt usually is a wrapper script that launches sbt-launch.jar in [home]/.sbt/launchers. Where that wrapper script is installed to heavily depends on how you installed it. SBT downloads its own scala version into a projects target path. It is totally local, so imo there is not reason to worry about installation relics. Thus, if you want to use scala 2.11.7, just set scalaVersion := 2.11.7 in your build.sbt
How to install older version of sbt?
I am facing some "UNRESOLVED DEPENDENCIES" problem for my custom dependencies with latest version of sbt(0.13.8) I want to install older version of sbt, Do we have any command by which I can install older version of sbt ?
You can define the sbt version by writing the one you need in /project/build.properties It would be something like: sbt.version=x.xx.x
Use the following command for a Debian-based Linux: sudo apt-get install sbt=0.13.13