Java 在 Ubuntu 上查找 gradle 路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38184232/
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
Find gradle path on Ubuntu
提问by user3512178
I have gradle installed on my Ubuntu 15.10 System.I want to find the location where it is.
I am following this (https://docs.gradle.org/current/userguide/tutorial_java_projects.html)
article.Here it is given that sample program can be found at samples/java/quickstart.
I want to open this sample program and for this I want to find location of gradle on my system.
我在 Ubuntu 15.10 系统上安装了 gradle。我想找到它所在的位置。
我正在关注这个(https://docs.gradle.org/current/userguide/tutorial_java_projects.html)文章。这里给出了可以在samples/java/quickstart.
我想打开这个示例程序,为此我想在我的系统上找到 gradle 的位置。
采纳答案by Mickael
There's multiple ways to locate where gradleis actually installed on your computer :
有多种方法可以找到gradle计算机上实际安装的位置:
locate: will locate where the bingradleis on your computer. Assuming,gradleis on yourPATH. It will most likely locate gradle in/usr/binor/usr/sharedirectory. If it locates the symbolic link use eitherls -lorreadlinkto see where the bin is actually located.which: similar aslocatefind: to use at end if neitherlocateneigherwhichworked. It's the "brutal" way. You can usefind / -name "gradle" 2> /dev/nullto find all occurence of gradle (exact match) on your computer.
locate: 将定位垃圾箱gradle在您的计算机上的位置。假设,gradle在你的PATH. 它很可能会在/usr/bin或/usr/share目录中找到 gradle 。如果它找到符号链接,请使用ls -l或readlink查看 bin 的实际位置。which: 类似locatefind: 如果两个locate邻居都不起作用,则在最后使用which。这是“残酷”的方式。您可以使用它find / -name "gradle" 2> /dev/null来查找计算机上所有出现的 gradle(完全匹配)。
回答by NanoNova
/usr/lib/gradle/default-> /usr/lib/gradle/5.x.xthe former is a link file targeted to actual directory which is the version you currently using.
/usr/lib/gradle/default->/usr/lib/gradle/5.x.x前者是指向实际目录的链接文件,该目录是您当前使用的版本。
apt install gradle in Ubuntu 18.10
在 Ubuntu 18.10 中安装 gradle
whichwill locate to /usr/bin/gradlewhich is gradle start up script.
which将定位到/usr/bin/gradle哪个是 gradle 启动脚本。

