3
votes

I am trying to use the PCF Dev from Pivotal for Cloud Foundry Development.

I want to setup my simple standalone jar file which only stdout hello every secound. I pushed it and everything seems to work fine except the start.

On start I get the following log error:

2016-05-10T13:09:45.28+0200 [APP/0]      ERR bash: JAVA_HOME: No such file or directory

My manifest.yml

applications:
  - name:    cf-test
    no-route: true
    memory:  128M
    instances: 1
    path: /bin/test.jar
    build: https://github.com/cloudfoundry/java-buildpack.git

For me it seems like Java isn't installed properly in the CF-Environment. But how to debugg that?

I really hope someone knows a answer :) Thank you!

Edit: I found out that i have to set the Environment-Variable of JAVA_HOME but to what? How to find out the Java Path?

2
Set it to the root directory of your Java installation tree. Search for set "JAVA_HOME" - Stephen C
Thanks for your reply.. I don't get it. I don't think the JAVA_HOME path is the only problem. Is cloud foundry made for applications that doesnt provide a web part? Do i have to configure something special? - ekul
@ekul: did you find the answer to your question? What is the path to the java executable? - Hoobajoob
I am searching for the same thing, what is the path to the java executable in the cloud foundry app. The answer doesn't seem to be related to the question at all. - Abhi

2 Answers

0
votes

See the docs on the health-check-type attribute

Use the health-check-type attribute to set the health_check_type flag to either port or none. If you do not provide a health-check-type attibute, it defaults to port.

---
  ...
  health-check-type: none

The command line option that overrides this attribute is -u.

Use none if your process is not like a web application that binds to a port, and instead is just a background worker that prints some logs.

1
votes

This is a very unfriendly point of Cloud Foundry, it does not set $JAVA_HOME by default.

Here are the ways how I solved this.

  1. Use Dist Zip container to push your app to CF, this way you can count on build pack itself to find the Java path.( https://github.com/cloudfoundry/java-buildpack/blob/master/docs/container-dist_zip.md)

  2. Use the Start Command of Cloud Foundry to set $JAVA_HOME, like: JAVA_HOME=.java-buildpack/open_jdk_jre/bin/

The java installation path is directly under the build pack. /home/vcap/app/.java-buildpack. You can find it if you use command line to view your CF.