Re: How to pass command line arguments to spring java app

Ben Hale <bhale@...>

The Java Main Container configuration documentation[1] describes the appropriate way to set command line arguments. Configuration can be done either with a fork of the buildpack or an environment variable.

$ cf set-env <APP> JBP_CONFIG_JAVA_MAIN ‘{arguments: “arg1 arg2”}’

-Ben Hale
Cloud Foundry Java Experience


On Dec 2, 2015, at 14:43, Evan Farrar <evanfarrar(a)> wrote:

I spoke too soon, I think that is the opposite of what you are looking for, sorry!

On Wed, Dec 2, 2015 at 2:39 PM, Evan Farrar <evanfarrar(a)> wrote:

I think the thing you are looking for is the JAVA_OPTS env variable:

On Wed, Dec 2, 2015 at 2:34 PM, Lakshman Mukkamalla (lmukkama) <lmukkama(a)> wrote:
Hi CF dev team,
I want to pass command line arguments to the spring java app. I have tried the option of setting them using the env ‘JBP_CONFIG_JAVA_MAIN’ as suggested in but its not working. Could anyone suggest what is the right way to pass the command line arguments. Currently the app is started with following command.
App xyz was started using this command `SERVER_PORT=$PORT $PWD/.java-buildpack/open_jdk_jre/bin/java -cp $PWD/.:$PWD/.java-buildpack/spring_auto_reconfiguration/spring_auto_reconfiguration-1.7.0_RELEASE.jar$TMPDIR -XX:OnOutOfMemoryError=$PWD/.java-buildpack/open_jdk_jre/bin/ -Xmx768M -Xms768M -XX:MaxMetaspaceSize=104857K -XX:MetaspaceSize=104857K -Xss1M -Dlogging.config=file:/home/vcap/app/logback.xml org.springframework.boot.loader.JarLauncher`

How the app is pushed: cf push –p xyz.jar


Join to automatically receive all group messages.