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

Quarkus应用执行heroku local web报ClassNotFoundException: $JAVA_OPTS

Quarkus应用本地Heroku部署失败

执行heroku local web时触发错误,具体信息如下:

heroku local web
21:55:27 web.1   |  错误:无法找到或加载主类 $JAVA_OPTS
21:55:27 web.1   |  原因:java.lang.ClassNotFoundException: $JAVA_OPTS
[DONE] Killing all processes with signal  SIGINT
21:55:27 web.1   Exited with exit code null

我按照《deploying-to-heroku》教程用Maven部署Quarkus应用到Heroku,但本地部署始终失败,已经在Windows 11和WSL2两种环境下测试过。应用在dev模式下运行正常,所有测试都能通过。

当前配置:

  • Procfile:web: java \$JAVA_OPTS -jar target/quarkus-app/quarkus-run.jar
  • system.properties:java.runtime.version=17
  • application.properties:quarkus.http.port=${PORT:8080}
  • pom.xml相关片段:
...
<compiler-plugin.version>3.11.0</compiler-plugin.version>
<maven.compiler.release>17</maven.compiler.release>
...
  • 仓库地址:github.com/jonasfroeller/rate-it

已经试过两种Procfile配置,结果都出现相同错误:

  1. web: java -Dquarkus.http.port=$PORT $JAVA_OPTS -jar target/quarkus-app/quarkus-run.jar
  2. 教程提供的原始配置(即当前使用的Procfile内容)

内容的提问来源于stack exchange,提问作者ihaveaquestion

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.08 06:15:16