title: JAVA_HOME is not set and no 'java' command could be found in your PATH. bitbucket pipeline
body: <p>Hi i tried to execute a gradle command in bitbucket pipeline</p>
  
  <pre><code>definitions:
    services:
      java:
        image: openjdk:8
  pipelines:
    default:
      - step:
          name: Build And Test
          services:
            - java
          script:
            - bash ./gradlew clean build
            - bash ./gradlew test
      - step:
          name: configure gcloud
          deployment: test
          image: google/cloud-sdk:214.0.0-alpine
          services:
            - java
            - docker
          caches:
            - gradle
          script:
            - gcloud auth configure-docker --quiet
            - docker login -u _json_key -p "$GCR_JSON_KEY" https://gcr.io
            - bash ./gradlew bake -Penv=test -PisRelease=false --info --stacktrace
  </code></pre>
  
  <p>when it tried to execute the latest task </p>
  
  <p>it give the error 
  JAVA_HOME is not set and no 'java' command could be found in your PATH. </p>
  
  <p>AS you see there's a java image and it works in the first step
  but in the second step if failed and this is the issue.</p>