You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

sbt 1.8.0与Java 11兼容性问题求助:启动报MaxPermSize错误

sbt 1.8.0 搭配Java 11启动报错排查

问题现象

下载sbt-1.8.0后,在目录C:\Users\fff\Downloads\sbt-1.8.0下执行sbt命令,出现如下报错:

\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.

当前使用的Java版本信息:

\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)

已知Java 8之后移除了MaxPermSize参数支持,需确认sbt 1.8是否不兼容Java 11?

解答

sbt 1.8.0完全兼容Java 11,报错根源是sbt配置文件中残留了仅Java 8及更早版本支持的MaxPermSize参数。

解决方法:

  • 找到sbt安装目录下的配置文件:Windows系统为conf/sbtconfig.txt,Linux/macOS为conf/sbtopts
  • 打开文件后,删除或注释掉包含-XX:MaxPermSize=256m的行
  • 保存配置后重新执行sbt命令即可正常启动

另外,首次启动时提示无build.sbt或project目录是正常现象,选择c继续即可,不影响核心功能运行。


内容的提问来源于stack exchange,提问作者blue-sky

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 11:10:23