SBT fails with `String.class is broken`

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


or per-project basis via


For example, to configure JDK used by sbt in current project, try setting in .sbtopts

-java-home /Users/picard/.sdkman/candidates/java/current

I had the same issue recently. What worked for me is to install SDKMAN(

$ curl -s "" | bash
$ source "$HOME/.sdkman/bin/"

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.

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.

This is what solved my problem on my Mac.

brew uninstall sbt

Install sdkman

curl -s "" | bash
source "$HOME/.sdkman/bin/"

Install sbt via sdk

sdk install sbt