heroku local web returns java.lang.ClassNotFoundException: \\$JAVA_OPTS for quarkus app

298 Views Asked by At

I did following tutorial using maven: deploying-to-heroku, but the local deployment fails (tried on Windows 11 and WSL2):

heroku local web
21:55:27 web.1   |  Fehler: Hauptklasse \\$JAVA_OPTS konnte nicht gefunden oder geladen werden
21:55:27 web.1   |  Ursache: java.lang.ClassNotFoundException: \\$JAVA_OPTS
[DONE] Killing all processes with signal  SIGINT
21:55:27 web.1   Exited with exit code null

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

I am not sure what I am doing wrong. The app works fine in dev mode and all of my tests pass.

I tried web: java -Dquarkus.http.port=$PORT $JAVA_OPTS -jar target/quarkus-app/quarkus-run.jar from Quarkus deployment erro on Heroku: Could not find or load main class $JAVA_OPTS too, but it returned the same error. And I tried web: java $JAVA_OPTS -jar target/quarkus-app/quarkus-run.jar from the tutorial. Same result.

Github Repo: https://github.com/jonasfroeller/rate-it

1

There are 1 best solutions below

3
On

The guide you linked to says

echo "web: java \$JAVA_OPTS -jar target/quarkus-app/quarkus-run.jar" >> Procfile

which will result in

web: java $JAVA_OPTS -jar target/quarkus-app/quarkus-run.jar

written to Procfile.

But you have put

web: java \$JAVA_OPTS -jar target/quarkus-app/quarkus-run.jar

to Procfile which then causes $JAVA_OPTS to not be replaced by the value of the environment variable but given literally to java which then understands this as the main class it should start and complains that it does not find it.

If you remove the erroneous backslash, I'd expect it to work, given the guide you use is correct and up-to-date, and you did not do further errors while following it.