i just want to have a simple Application like Hello World run as a Task on CloudFoundry.
So i want to cf run-task myapp firstArgument secondArgument
Is it possible to deploy an app on Cloud Foundry and start this jar like on a linux Console.
java -jar simpleApp.jar firstargument seconArgument
Yes, that is 100% possible.
java -jar your-app.jar
.cf push -p path/to/youar-app.jar
your application. The Java buildpack should detect the app & install the software required to run the app. cf stop
.cf run-task <your-app> <arg1> <arg2> ...
. The trick is that Java will not be on the $PATH so you need to use the full path to the Java executable, which is .java-buildpack/open_jdk_jre/bin/java
. For example, if you wanted to print the Java version, cf run-task your-cool-app ".java-buildpack/open_jdk_jre/bin/java -version"
(make sure you have the command quoted, escape quotes within the command accordingly).See this SO post for more background on running tasks: https://stackoverflow.com/a/67872218/1585136
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.