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

**URL:** <https://discuss.gradle.org/t/caused-by-java-lang-classnotfoundexception-org-gradle-wrapper-gradlewrappermain/6436>\
**Category:** Old Forum Archive\
**Created:** [January 11, 2012, 5:39pm UTC](https://discuss.gradle.org/t/caused-by-java-lang-classnotfoundexception-org-gradle-wrapper-gradlewrappermain/6436 "2012-01-11T17:39:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![groovybayo](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@groovybayo](https://discuss.gradle.org/u/groovybayo)\
**Post date:** [January 11, 2012, 5:39pm UTC](https://discuss.gradle.org/t/caused-by-java-lang-classnotfoundexception-org-gradle-wrapper-gradlewrappermain/6436/1 "2012-01-11T17:39:00Z")

</div>

When trying to use the gradle wrapper, I keep getting the error above.

Here is my build file

```gradle
apply plugin: 'war'
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'jetty'
apply plugin: 'project-report'
  basePackageDir = 'com/mycompany/someproject'
  allprojects {
 sourceCompatibility = 1.6
 }
  idea {
  project {
    jdkName = '1.6'
    languageLevel = '1.5'
  }
}
  repositories(){
 mavenCentral()
}
  dependencies(){}
  jettyRun {
    httpPort = 9090
    stopKey = 'pa$$!'
}
  [compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all']
  task wrap( type: Wrapper ) { gradleVersion = '1.0-milestone-7' }

```

Steps: \> gradle wrap \> ./gradlew clean

Then, I get the error.

I can however run gradle alone. i.e. gradle clean

Gradle Info: ------------------------------------------------------------ Gradle 1.0-milestone-7 ------------------------------------------------------------

Gradle build time: Thursday, January 5, 2012 10:24:43 AM UTC Groovy: 1.8.4 Ant: Apache Ant™ version 1.8.2 compiled on December 20 2010 Ivy: 2.2.0 JVM: 1.6.0\_29 (Sun Microsystems Inc. 20.4-b02) OS: Windows 7 6.1 x86

Please advice.

Thanks

---

<div class="post-metadata">

**Author:** ![adammurdoch](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/adammurdoch/32/17_2.png) [@adammurdoch](https://discuss.gradle.org/u/adammurdoch)\
**Post date:** [January 11, 2012, 10:49pm UTC](https://discuss.gradle.org/t/caused-by-java-lang-classnotfoundexception-org-gradle-wrapper-gradlewrappermain/6436/2 "2012-01-11T22:49:00Z")

</div>

Do you have a stacktrace for the failure? You can run with the --stacktrace option to get a stacktrace.

---

<div class="post-metadata">

**Author:** ![groovybayo](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@groovybayo](https://discuss.gradle.org/u/groovybayo)\
**Post date:** [January 12, 2012, 10:30am UTC](https://discuss.gradle.org/t/caused-by-java-lang-classnotfoundexception-org-gradle-wrapper-gradlewrappermain/6436/3 "2012-01-12T10:30:00Z")

</div>

Adam - running ./gradlew --stacktrace clean yields the same error.

It is as though, it can’t find the gradle executable.

I am running cygwin on windows.

I have narrowed it down to this.

Running ./gradlew in the cygwin shell doesn’t work.

However, running ./gradlew.bat works just fine.

I have run this things this way and only started hitting this errors when I re-created the wrapper with the new milestone.

Any clues?

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [January 12, 2012, 3:59pm UTC](https://discuss.gradle.org/t/caused-by-java-lang-classnotfoundexception-org-gradle-wrapper-gradlewrappermain/6436/4 "2012-01-12T15:59:00Z")

</div>

Can you just post the complete output you get (unchanged)?

From my experience, running Gradle in cygwin is problematic. For example, I’ve been seeing a tenfold increase in startup time compared to the command prompt. I don’t know who’s to blame for this.

---

<div class="post-metadata">

**Author:** ![James\_Owen](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@James\_Owen](https://discuss.gradle.org/u/James_Owen)\
**Post date:** [August 6, 2014, 3:46pm UTC](https://discuss.gradle.org/t/caused-by-java-lang-classnotfoundexception-org-gradle-wrapper-gradlewrappermain/6436/5 "2014-08-06T15:46:00Z")

</div>

Thanks David, I’ve just wasted a whole day wondering why I was getting this error. Feel like a complete idiiot now!

---

<div class="post-metadata">

**Author:** ![David\_Sanders](https://avatars.discourse-cdn.com/v4/letter/d/2bfe46/32.png) [@David\_Sanders](https://discuss.gradle.org/u/David_Sanders)\
**Post date:** [September 12, 2013, 12:34pm UTC](https://discuss.gradle.org/t/caused-by-java-lang-classnotfoundexception-org-gradle-wrapper-gradlewrappermain/6436/6 "2013-09-12T12:34:00Z")

</div>

I was getting this too - I found that I hadn’t committed the gradle/wrapper/gradle-wrapper.jar, due to jars being on my git ignore list.

‘git add -f gradle/wrapper/gradle-wrapper.jar’ did the trick.
