# How to specify java version when running gradle build?

**URL:** <https://discuss.gradle.org/t/how-to-specify-java-version-when-running-gradle-build/17489>\
**Category:** Help/Discuss\
**Created:** [May 6, 2016, 10:34am UTC](https://discuss.gradle.org/t/how-to-specify-java-version-when-running-gradle-build/17489 "2016-05-06T10:34:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrNiamh](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@MrNiamh](https://discuss.gradle.org/u/MrNiamh)\
**Post date:** [May 6, 2016, 10:34am UTC](https://discuss.gradle.org/t/how-to-specify-java-version-when-running-gradle-build/17489/1 "2016-05-06T10:34:55Z")

</div>

Hi there,

I’m trying to build a .jar ([https://github.com/Backblaze/JavaReedSolomon](https://github.com/Backblaze/JavaReedSolomon)) specifically. Running “grade build” from command line works as it should, but it’s giving me a jar in java 1.8, whereas I need 1.6. When I do gradle -version it says my java is 1.8, which makes sense. How would I go about changing it so it uses 1.6?

Thanks

---

<div class="post-metadata">

**Author:** ![MrNiamh](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@MrNiamh](https://discuss.gradle.org/u/MrNiamh)\
**Post date:** [May 6, 2016, 2:28pm UTC](https://discuss.gradle.org/t/how-to-specify-java-version-when-running-gradle-build/17489/2 "2016-05-06T14:28:49Z")

</div>

Fixed. Just had to add sourceCompatibility = 1.6 to the build.gradle
