请注意:这个问题不是一个骗子,任何阅读它的人都会看到。我不是要求如何在我的Mac上找到JAVA_HOME`?我问的是当JAVA_HOME没有设置时Gradle是如何运行的。两个完全不同的问题。差异甚至在标题中。彻底阅读问题的人!
Mac 10.11.6(El Capitan)Java开发人员。我的机器已经使用了一年多,并且一直在构建Java应用程序。
在终端中,如果我运行echo $JAVA_HOME
,则输出为空/空白:
myMachine:myDir myUser$ echo $JAVA_HOME
邮编。 Nadda。没什么。但是如果我运行which java
,我会得到:
myMachine:myDir myUser$ which java
/usr/bin/java
因此安装了Java,但$JAVA_HOME
以某种方式为空/ null /空白。
如果我克隆this repo并运行./gradlew run
,它就会完美执行:
./gradlew run
:compileJava UP-TO-DATE
:compileScala
:processResources UP-TO-DATE
:classes
:run
Hello!
BUILD SUCCESSFUL
Total time: 8.478 secs
我想知道:如果没有设置JAVA_HOME
,那么Gradle如何成功运行?! 通过$JAVA_HOME
安装Java时是否应该设置brew
?
当我echo $PATH
时,我看到了:
/Users/myUser/.rvm/gems/ruby-2.4.0/bin
/Users/myUser/.rvm/gems/ruby-2.4.0@global/bin
/Users/myUser/.rvm/rubies/ruby-2.4.0/bin
/opt/local/bin
/opt/local/sbin
/Users/myUser/.sdkman/candidates/scala/current/bin
/Users/myUser/.sdkman/candidates/sbt/current/bin
/Users/myUser/.sdkman/candidates/maven/current/bin
/Users/myUser/.sdkman/candidates/lazybones/current/bin
/Users/myUser/.sdkman/candidates/groovy/current/bin
/Users/myUser/.sdkman/candidates/gradle/current/bin
/Users/myUser/.sdkman/candidates/ant/current/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/opt/X11/bin
/usr/local/go/bin
/Users/myUser/.rvm/bin
/Users/myUser/.rvm/bin
答案 0 :(得分:3)
文档说:
[{"id":"1234","label":"Player","status":"ACTIVE"},{"id":"1235","label":"Player","status":"ACTIVE"}, ...]
检查你的路径变量及其值,也许已经指出了Java。