Can not run gradlew on Windows 7 64bit

Hi,

I have two project using Gradle. One is generated by IntelliJ IDE (projectA), the other is generated by Android Studio (projectB).

From projectA’s root directory, if I ran “gradlew” from a cygwin shell, everything works fine. But from the projectB’s root directory, when I ran “gradlew”, I got this error:

java.lang.NoClassDefFoundError: org/gradle/wrapper/GradleWrapperMain

Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain

at java.net.URLClassLoader$1.run(URLClassLoader.java:202)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Could not find the main class: org.gradle.wrapper.GradleWrapperMain. Program will exit.

Exception in thread “main”

I checked the “gradle” directory and the scripts generated in each of the project’s, they looks all the same. I checked this forum as well, and there’re a lot issues with similar error output, but none of them can help me fix this problem.

Sounds like something might be wrong with the wrapper files installed for projectB.

But for projectB, if I build the project from Android Studio, everything works fine. I think Android Studio also uses Gradle, no?

Yes, but it doesn’t use the wrapper files (except for ‘gradle-wrapper.properties’).

Ah~thanks. The .jar files are really different…Now, it works :slight_smile: