gradlew command not found?

JavaLinuxGradleInstallation

Java Problem Overview


I am working on a Java project with gradlew. I use Ubuntu Linux as my OS. When I run "gradle" it runs, and gives me info. But when I run "gradlew", it outputs as "No command 'gradlew' found, did you mean: Command 'gradle' from package 'gradle' (universe) gradlew: command not found"

I did my research, I have jdk, and I did sudo apt-get install gradle. I am totally clueless

Error is:

$ gradlew clean jpackage
bash: gradlew: command not found...

Java Solutions


Solution 1 - Java

Linux / MacOS

As noted in the comments, just running

./gradlew

worked for me. Adding the ./ tells it to look in the current directory since it isn't in the path.

Windows PowerShell
.\gradlew

Solution 2 - Java

Gradle wrapper needs to be built. Try running gradle wrapper --gradle-version 2.13 Remember to change 2.13 to your gradle version number. After running this command, you should see new scripts added to your project folder. You should be able to run the wrapper with ./gradlew build to build your code. Please refer to this guid for more information https://spring.io/guides/gs/gradle/.

Solution 3 - Java

Running this bash command works for me by running chmod 755 gradlew as sometimes file properties changed upon moving from one OS to another (Windows, Linux and Mac).

Solution 4 - Java

If you are using mac, try giving root access to gradlew by doing

chmod +x ./gradlew

Solution 5 - Java

the same problem occurs to me... I check the file wrx permissions with:
$ls -l ./gradlew -> -rw-rw-r-- (no execute permission)

so I use command $chmod +x ./gradlew and this problem solved.

Solution 6 - Java

From mac,

Nothing is working except the following command

chmod 777 gradlew Then

./gradlew

Solution 7 - Java

In addition to @suraghch

Linux / MacOS ./gradlew clean

Windows PowerShell .\gradlew clean

Windows cmd gradlew clean

Solution 8 - Java

You must have the Gradle wrapper available locally before using gradlew. To construct that

gradle wrapper # --gradle-version v.xy

Optionally, pass the gradle version explicitly. This step produces the gradlew binary.And then you should be able to

./gradlew build

Solution 9 - Java

For Ubuntu(linux) users: doing "bash ./gradlew build " works but "./gradlew build " doesnot work.

For me the issue was it was on NTFS file system, linux does not let execute a script from NTFS. Try moving the code from NTFS to a linux partition. then ./gradlew build should work

Solution 10 - Java

If you are using VS Code with flutter, you should find it in your app folder, under the android folder:

C:\myappFolder\android

You can run this in the terminal:

./gradlew signingReport

Solution 11 - Java

First thing is you need to run the gradle task that you mentioned for this wrapper. Ex : gradle wrapper After running this command, check your directory for gradlew and gradlew.bat files. gradlew is the shell script file & can be used in linux/Mac OS. gradlew.bat is the batch file for windows OS. Then run,

./gradlew build (linux/mac). It will work.

Solution 12 - Java

If the answer marked as correct does not work, it is because you need to identify yourself as a super user.

> sudo gradle wrapper --gradle-version 2.13

It worked for me.

Solution 13 - Java

if you are trying to run this command for flutter app then goto android folder first by cd android and then use the command it should work. cd android > ./gradlew signingReport

Solution 14 - Java

In a Flutter project, don't forget to go to 'android' folder with 'cd android' Then you can run a command like './gradlew build' or './gradlew clean' on it (mac OS)

Solution 15 - Java

I use intellj idea and in windows in terminal type: gradlew.bat run it is working for me.

Solution 16 - Java

> Hi @Hayden Stites I faced the same issue, but after some tries I found > it was happening because I was trying to create build in git bash , > instead of CMD with admin access. If you create build with Command > prompt run as administrator build will get create.

Solution 17 - Java

Instead of gradlew assembleRelease use ./gradlew assembleRelease

Solution 18 - Java

Issue: Couldn't find gradlew at path jenkins

In my case within jenkins CI for flutter project, I have to first run flutter build app command then it automatically generated gradlew file. And above issue resolved.

I put this command in my jenkins file:

flutter build apk

Solution 19 - Java

I had to do dos2unix * in my current folder to make it work

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHaydenView Question on Stackoverflow
Solution 1 - JavaSuragchView Answer on Stackoverflow
Solution 2 - JavaAlex WilsonView Answer on Stackoverflow
Solution 3 - JavaAyman MahgoubView Answer on Stackoverflow
Solution 4 - JavaPankaj GaikarView Answer on Stackoverflow
Solution 5 - JavashanwuView Answer on Stackoverflow
Solution 6 - JavaMD. Shafiul Alam BiplobView Answer on Stackoverflow
Solution 7 - JavaSanjeev RaoView Answer on Stackoverflow
Solution 8 - JavaRounak DattaView Answer on Stackoverflow
Solution 9 - JavaAbhishekView Answer on Stackoverflow
Solution 10 - Javalive-loveView Answer on Stackoverflow
Solution 11 - JavaSumukha H SView Answer on Stackoverflow
Solution 12 - JavaAnxo PView Answer on Stackoverflow
Solution 13 - JavaGurminder KalerView Answer on Stackoverflow
Solution 14 - JavaFlorian KView Answer on Stackoverflow
Solution 15 - JavaA MoView Answer on Stackoverflow
Solution 16 - JavaVishal PachpandeView Answer on Stackoverflow
Solution 17 - JavaNikhil JainView Answer on Stackoverflow
Solution 18 - JavamaddyView Answer on Stackoverflow
Solution 19 - JavaAjay MenonView Answer on Stackoverflow