Search code examples
scalasbt

SBT main class "not" not found


I'm seeing a strange issue when trying to run sbt on any of my projects on my new Mac. These are known-good projects so it is likely to be something up with sbt on my new machine (installed using brew install sbt).

As you can see below something is "not[newline]found", which is leading to the "Could not find or load main class not" error. I can't tell what this is or why it is happening, has anyone seen this before?

sbt -v
[sbt_options] declare -a sbt_options='([0]="-Dsbt.jse.engineType=Node" [1]="-Dsbt.jse.command=node" [2]="not" [3]="found")'
[process_args] java_version = '8'
# Executing command line:
java
-Dfile.encoding=UTF-8
-Xms1024m
-Xmx1024m
-Xss4M
-XX:ReservedCodeCacheSize=128m
-Dsbt.jse.engineType=Node
-Dsbt.jse.command=node
not
found
-jar
/usr/local/Cellar/sbt/1.5.6/libexec/bin/sbt-launch.jar

Error: Could not find or load main class not


Solution

  • Thanks to @LuisMiguelMejíaSuárez for the answer that helped get this working.

    1. Uninstalled brews version of sbt (brew uninstall sbt)
    2. Installed coursier CLI (https://get-coursier.io/docs/cli-installation)
    3. Installed sbt via coursier (cs install sbt).