# Generating native headers?

**URL:** <https://discuss.gradle.org/t/generating-native-headers/1279>\
**Category:** Old Forum Archive\
**Created:** [December 1, 2014, 2:56pm UTC](https://discuss.gradle.org/t/generating-native-headers/1279 "2014-12-01T14:56:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbarker](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/bbarker/32/359_2.png) [@bbarker](https://discuss.gradle.org/u/bbarker)\
**Post date:** [December 1, 2014, 2:56pm UTC](https://discuss.gradle.org/t/generating-native-headers/1279/1 "2014-12-01T14:56:00Z")

</div>

First, sorry for the double post; I posted this question in a rather old and resolved thread and realized that, for this forum, that may not be a good idea.

In 2.2.1, I ran into a JNI problem with some previously working JNI examples ( [https://github.com/bbarker/gradle-examples](https://github.com/bbarker/gradle-examples) ). The following line:

```gradle
jniPlatformCExtractHeaders.dependsOn nativeHeaders

```

results in:

- What went wrong: A problem occurred evaluating root project ‘gradle-examples’. \> Could not find property ‘jniPlatformCExtractHeaders’ on project ‘:jvm:jni’.

I verified the build worked in the 2.0 gradle wrapper script. In 2.2.1, it appears that the headers are not building put in to $buildDir/nativerHeaders, which is where they should be going, so I assume that is what jniPlatformCExtractHeaders is doing (running javah). How to do this in 2.2.1?

Also, I can’t seem to find any JNI examples in the existing repository. Having one or more maintained JNI examples in gradle might be a big help. Sorry if I’m looking in the wrong place!

---

<div class="post-metadata">

**Author:** ![bbarker](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/bbarker/32/359_2.png) [@bbarker](https://discuss.gradle.org/u/bbarker)\
**Post date:** [December 3, 2014, 11:14pm UTC](https://discuss.gradle.org/t/generating-native-headers/1279/2 "2014-12-03T23:14:00Z")

</div>

Fixed now, I removed the offending line and added

tasks.withType(CCompile) {task -\> task.dependsOn nativeHeaders}
