foreman can't find java

2019-08-06 19:30发布

问题:

I'm trying to use foreman to run a java app locally which deploys fine to heroku.

My Procfile looks like this

web: java $JAVA_OPTS -cp target/classes;target/dependency/* Start

but when i do formeman start i get

15:51:21 web.1  | unknown command: java $JAVA_OPTS -cp target/classes;target/dependency/* Start

If I just enter java at the prompt i get java's help text back so its on my path. If I use the full path to the java executable in the Procfile it works, but it'd be cleaner if I didn't need two versions of the Procfile

Is there somethinf funky going on with my path or is foreman not getting the path from my environment?

回答1:

Could it be the environment variable is the problem?

Windows:

    java %JAVA_OPTS% -cp target/classes;target/dependency/* Start

Linux:

    java $JAVA_OPTS -cp target/classes:target/dependency/* Start

Looks like the example is a mix of both :-)

Environment variable