3

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?

zb226
  • 9,586
  • 6
  • 49
  • 79
ekul
  • 99
  • 1
  • 9
  • Set it to the root directory of your Java installation tree. Search for `set "JAVA_HOME"` – Stephen C May 10 '16 at 13:10
  • 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 May 10 '16 at 14:26
  • 1
    @ekul: did you find the answer to your question? What is the path to the java executable? – Hoobajoob Jan 09 '18 at 21:06
  • 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 Mar 26 '18 at 16:42

2 Answers2

1

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.

Wayne Wei
  • 2,907
  • 2
  • 13
  • 19
0

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.

Amit Kumar Gupta
  • 17,184
  • 7
  • 46
  • 64
  • 2
    This seems like a strange answer to the question of what the path is to the jre in a cloud foundry. What does health-check-type have to do with the path to the java executable for a cf app launched with the java buildpack? I'm still trying to find out the answer to the OP's original question! – Hoobajoob Jan 09 '18 at 21:05