Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Gradle's wrapper in Linux has to be started in this way?

I have a Gradle project with this structure:

ls -alh

drwxr-xr-x 9 Xelian 4.0K Aug  5 22:39 .
drwxrwxr-x 3 Xelian 4.0K Aug  5 16:19 ..
-rw-rw-r-- 1 Xelian  465 Aug  5 16:19 build.gradle
drwxrwxr-x 8 Xelian 4.0K Aug  5 16:38 buildSrc
drwxrwxr-x 3 Xelian 4.0K Aug  5 16:19 gradle
drwxrwxr-x 3 Xelian 4.0K Aug  5 16:45 .gradle
-rwxrwxrwx 1 Xelian 5.0K Aug  5 17:29 gradlew
-rw-rw-r-- 1 Xelian 2.3K Aug  5 16:19 gradlew.bat
-rw-rw-r-- 1 Xelian 17K Aug  5 16:19 README.md
-rw-rw-r-- 1 Xelian   30 Aug  5 16:19 settings.gradle

And to execute the gradlew bash file I write:

gradlew -v

Output:

No command 'gradlew' found, did you mean:
 Command 'gradle' from package 'gradle' (universe)
gradlew: command not found

If I write :

 ./gradlew -v 

Everything works fine.

Does ./ mean current directory?

like image 780
Xelian Avatar asked Jan 10 '23 02:01

Xelian


1 Answers

When you type:

command

Your shell will search all the directories listed in your $PATH environment variable, in order, for an executable with the name "command".

When you type:

./command

The ./ part explicitly tells your shell that you want to execute the file named "command" in the current directory (. is interpreted as the current directory).

If you want to be able to run it with just command, you will have to add the current directory to your PATH, or move the executable to somewhere already on your PATH

like image 112
Andrew Stubbs Avatar answered Jan 19 '23 16:01

Andrew Stubbs