JAVA_HOME 未设置,并且在您的 PATH 中找不到“java”命令。位桶管道
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52095689/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JAVA_HOME is not set and no 'java' command could be found in your PATH. bitbucket pipeline
提问by M1M6
Hi i tried to execute a gradle command in bitbucket pipeline
嗨,我试图在 bitbucket 管道中执行一个 gradle 命令
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
when it tried to execute the latest task
当它试图执行最新的任务时
it give the error JAVA_HOME is not set and no 'java' command could be found in your PATH.
它给出了错误 JAVA_HOME 未设置并且在您的路径中找不到“java”命令。
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.
正如您看到的那样,有一个 Java 映像,它在第一步中有效,但如果失败,则在第二步中,这就是问题所在。
回答by KunLun
You had set JAVA_HOME? If not, read here
你有没有设置JAVA_HOME?如果没有,请阅读这里
To set JAVA_HOME, do the following:
a. Right click My Computer and select Properties.
b. On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:\Program Files\Java\jdk1.6.0_02.
要设置 JAVA_HOME,请执行以下操作:
一种。右键单击我的电脑并选择属性。
湾 在高级选项卡上,选择环境变量,然后编辑 JAVA_HOME 以指向 JDK 软件所在的位置,例如 C:\Program Files\Java\jdk1.6.0_02。