Raphael
Raphael

Reputation: 1800

Beanstalk Java platform with parameters

I'm using the Java platform in a Beanstalk application and I'm trying to read an environment property and pass as a java system parameter:

My Procfile inside the zip bundle says:

web: java $JAVA_OPTS -jar app.jar

The defined "Environment Properties"

JAVAOPTS -> -DXyz=123

But during launch, I see in the logs:

Error: Could not find or load main class $JAVA_OPTS

Is it possible to pass variables to the java process in such way?

Upvotes: 0

Views: 589

Answers (1)

Raphael
Raphael

Reputation: 1800

For some reason, the Procfile wont't allow parameters to be passed that way. My work around war, calling a shell script that passes the parameters:

Procfile

web: sh ./run.sh

./run.sh

#!/bin/bash
java $JAVA_OPTS -jar application.jar $JAVA_ARGS

That allow parameters to be se in the Environment Variables of beanstalk configuration console.

Upvotes: 1

Related Questions