When importing sbt projects you may see the following not very informative error message:
Error while importing sbt project:
java.lang.VerifyError: Uninitialized object exists on backward branch 487
Exception Details:
Location:
scala/reflect/internal/Types.appliedType(Lscala/reflect/internal/Types$Type;Lscala/collection/immutable/List;)Lscala/reflect/internal/Types$Type; @545: goto
Reason:
Error exists in the bytecode
Bytecode:
0x0000000: 2cb6 02dd 9900 052b b003 3606 013a 072b
0x0000010: c101 7899 0075 0436 062b c001 783a 0719
0x0000020: 07b6 05d1 3a08 1907 b604 de3a 092a c000
0x0000030: 3fb9 04c9 0100 b606 0619 09b6 029e 9900
How to fix it
Your JDK setting may be incorrect. You need to tell SBT which JRE to use and you need to give it a JRE that it can work with.
- Bring up the IntelliJ IDEA-Preferences dialog (on Windows IntelliJ IDEA-Settings),
- Type in “sbt” in the search box on top of the left side column
- Ignore the highlighted areas.
- Download the most recent JDK from hereĀ https://www.oracle.com/technetwork/java/javase/overview/index.html
- Find the JVM-JRE field on the right side and click on the … to find the JDK you have just downloaded and select that. (On a mac you need to pick a path likeĀ /Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home).
The following picture shows what this looks like on the MAC.
Reimporting
Once you configured the correct JRE, you need to reimport the SBT project by clicking the refresh icon in the SBT panel on the right side of IntelliJ. For me this is the first icon in the row of SBT icons on the panel.