Can not run gradlew on Windows 7 64bit


(Xi Shen) #1

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.


(Peter Niederwieser) #2

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


(Xi Shen) #3

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


(Peter Niederwieser) #4

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


(Xi Shen) #5

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