ClassCastException when sbt sync, getting class java.lang.UnsupportedOperationException cannot be cast to class xsbti.FullReload

Viewed 231

I recently upgraded to the m1 mac. And am trying to set up my scala environment for a project. However, I'm getting this error when I'm trying to get my sbt to sync.

[error] [launcher] error during sbt launcher: java.lang.ClassCastException: class java.lang.UnsupportedOperationException cannot be cast to class xsbti.FullReload (java.lang.UnsupportedOperationException is in module java.base of loader 'bootstrap'; xsbti.FullReload is in unnamed module of loader 'app')

I was on corretto at first. But then I read somewhere and downloaded temurin via installing through sdk using

sdk install java
sdk install sbt

After installing it, I'm able to run sbt on the project in my terminal. However, within Intellij (even after changing the java sdk to temurin). I'm still getting that error.

1 Answers

The solution that I came upon to fix this was by using the right Java sdk. Using Corretto wasn't working, so I used sdkman to download java sdk instead. It downloaded Java Temurin, and i then changed to use Temurin. It worked after.

Related