1

I've download sbt-1.8.0, when I try to run sbt I receive error :

\Downloads\sbt-1.8.0>sbt
[warn] Neither build.sbt nor a 'project' directory in the current directory: C:\Users\fff\Downloads\sbt-1.8.0
c) continue
q) quit
? c
Unrecognized VM option 'MaxPermSize=256m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
The filename, directory name, or volume label syntax is incorrect.
Unrecognized VM option 'MaxPermSize=256m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Unrecognized VM option 'MaxPermSize=256m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I'm using Java 11 version :

\Downloads\sbt-1.8.0>java -version
openjdk version "11.0.16.1" 2022-08-12
OpenJDK Runtime Environment Temurin-11.0.16.1+1 (build 11.0.16.1+1)
OpenJDK 64-Bit Server VM Temurin-11.0.16.1+1 (build 11.0.16.1+1, mixed mode)

My understanding is that MaxPermSize support has been removed from Java post version 8 ? Is sbt1.8 not compatible with Java 11 ?

Gaël J
  • 11,274
  • 4
  • 17
  • 32
blue-sky
  • 51,962
  • 152
  • 427
  • 752
  • 2
    Maybe not related but the first error is that you're running SBT in a folder which is not a SBT project. – Gaël J Dec 17 '22 at 11:45
  • 3
    Do you have `SBT_OPTS` env variable? – Gaël J Dec 17 '22 at 11:46
  • 3
    sbt should work with Java 11. `Neither build.sbt nor a 'project' directory` is a warning, not error. I can see that you're starting sbt from sbt 1.8 folder but not sure that you're starting sbt 1.8. Normally it's in `bin` subdirectory, so try something like `./bin/sbt`. Also please add output of `which java`, `echo $JAVA_HOME`, `which sbt`, `echo $SBT_OPTS`, `echo $JAVA_OPTS`, `echo $PATH`. – Dmytro Mitin Dec 17 '22 at 15:01
  • 3
    Also if there was previous `sbt` installation maybe you could try to delete `~/.sbt` – Dmytro Mitin Dec 17 '22 at 15:08
  • 1
    https://stackoverflow.com/questions/47112412/unrecognized-vm-option-maxpermsize-512m-when-running-zeppelin https://stackoverflow.com/questions/31411989/android-studio-unrecognized-vm-option-maxpermsize-256m – Dmytro Mitin Dec 17 '22 at 15:35
  • 1
    https://docs.scala-lang.org/getting-started/index.html#create-a-hello-world-project-with-sbt – Dmytro Mitin Dec 17 '22 at 16:03
  • 1
    You should start sbt from the directory where you have a project or where you'd like to create a project (starting from a different directory is in principle [possible](https://stackoverflow.com/questions/74440324/sbt-gives-java-lang-nullpointerexception-when-trying-to-run-spark) but tricky). Now you seem trying to create a new project in sbt installation folder. – Dmytro Mitin Dec 17 '22 at 16:10
  • 1
    Do you have any updates? – Dmytro Mitin Dec 20 '22 at 01:44
  • I'm going to vote to close this question as a machine restart fixed the issue, im unsure as to the cause. – blue-sky Dec 26 '22 at 00:59

1 Answers1

0

I was using this sbt version in my project along with jdk1.8.0.171:

:project/build.properties

sbt.version=0.13.17

but due to some issue, I had to replace my laptop and reconfigure all setups, however, my sbt version in the project was the same but I had installed an upgraded jdk jdk1.8.0.361 which was causing this issue.

build.properties
sbt.version=0.13.17

I re-installed the jdk1.8.0.171 and now it is working fine for me.

suv1sh
  • 43
  • 1
  • 10