while installing sbt 0.13.15, it fails because it asks for openjdk-8. But I am running oracle jdk 8 and want to run sbt with it. How can I do this?
This error is shown
sbt depends on openjdk-8-jdk; however:
Package openjdk-8-jdk is not installed.
dpkg: error processing package sbt (--install):
dependency problems - leaving unconfigured
Related
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. :)
Hi I am unable to install scala on a phusion base-image
https://gist.github.com/geoHeil/f52bb118303157cafd77e0c49db3de71
The image contains java8
but the installation of scala fails with
dpkg: dependency problems prevent configuration of scala:
scala depends on libjansi-java; however:
Package libjansi-java is not installed.
dpkg: error processing package scala (--install):
dependency problems - leaving unconfigured
Which normally would indicate java is not installed.
But java_home is set correctly and java-executable is in the path.
There must be a problem with the 10.5 version of the deb file. 11.6 works like a charm
Hi I am trying to install sbt.
I have Oracle Java installed (not openJDK):
java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
But when I try to install SBT I am getting this:
sudo apt-get install sbt
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
sbt : Depends: java6-runtime-headless
Recommends: git
scala : Depends: java6-runtime-headless
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
EDIT:
got the same response when using
apt-get -f install sbt
The error message says:
apt-get -f install
'f' means 'fix broken', because something wrong with your current package repo
'apt-get -f install sbt' is wrong!
I'd recommend skipping the .deb install of sbt and scala and just installing sbt manually as per http://www.scala-sbt.org/0.13/tutorial/Manual-Installation.html
Then for interactive scala play, just use ./sbt console
This makes it easy to play with different versions of scala by simply having directories with different sbt project files.
I had remove scala
and then install java8 installer following this instructions
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
After a fresh install of Ubuntu 15.04, I attempted to install and run SBT using the instructions from www.scala-sbt.org. It installed fine, but when I run it for the first time, I get a bunch of errors:
~$ sbt
...
:::: ERRORS
Server access Error: java.lang.RuntimeException: Unexpected error:
java.security.InvalidAlgorithmParameterException: the trustAnchors
parameter must be non-empty
url=https://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.9/sbt-0.13.9.jar
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-sbt#sbt;0.13.9: not found
Error during sbt execution: Error retrieving required libraries
(see /root/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 0.13.9
What is going wrong?
I have had same problem with xubuntu 15.10. I installed package ca-cacert:
sudo apt-get install ca-cacert
It solved this problem.
After a bit of debugging, I found that the cacerts file is missing from the latest version of OpenJDK.
All I had to do was copy the cacerts file from /etc/ssl/certs/java/cacerts from a working computer to my new workstation, and it worked fine.
I've made my file available at this link.