Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAVA_HOME not found in Cloud Foundry deployment

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?

like image 986
ekul Avatar asked Mar 07 '26 03:03

ekul


1 Answers

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.

like image 94
Wayne Wei Avatar answered Mar 08 '26 18:03

Wayne Wei



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!