# How to use LWJGL? Or: how to use native libraries?

**URL:** <https://discuss.gradle.org/t/how-to-use-lwjgl-or-how-to-use-native-libraries/7498>\
**Category:** Old Forum Archive\
**Created:** [January 16, 2012, 9:17pm UTC](https://discuss.gradle.org/t/how-to-use-lwjgl-or-how-to-use-native-libraries/7498 "2012-01-16T21:17:00Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![kiras](https://avatars.discourse-cdn.com/v4/letter/k/dfb087/32.png) [@kiras](https://discuss.gradle.org/u/kiras)\
**Post date:** [January 20, 2012, 4:53am UTC](https://discuss.gradle.org/t/how-to-use-lwjgl-or-how-to-use-native-libraries/7498/7 "2012-01-20T04:53:00Z")

</div>

Still no luck… Here is my build.gradle:

```gradle
apply plugin: 'java'
  repositories {
    mavenCentral()
}
  dependencies {
    compile 'org.lwjgl.lwjgl:lwjgl:2.8.2'
}
  task copyNativesWindows(type: Copy) {
    from configurations.compile.files {
         it instanceof ExternalModuleDependency && it.artifacts.every { it.classifier == 'natives-windows' }
    }
     into "$buildDir/natives/windows"
}

```

If I run “gradle clean” followed by “gradle copyNativesWindows”, $buildDir/natives/windows looks like this:

jinput-2.0.5.jar jinput-platform-2.0.5-natives-linux.jar jinput-platform-2.0.5-natives-osx.jar jinput-platform-2.0.5-natives-windows.jar jutils-1.0.0.jar lwjgl-2.8.2.jar lwjgl-platform-2.8.2-natives-linux.jar lwjgl-platform-2.8.2-natives-osx.jar lwjgl-platform-2.8.2-natives-windows.jar

I would have expected it to look more like: jinput-platform-2.0.5-natives-windows.jar lwjgl-platform-2.8.2-natives-windows.jar

Really not sure what I am doing wrong.

I have tried getting more information about what exactly is happening in copyNativesWindows. For example, I have tried something like this:

```gradle
task copyNativesWindows(type: Copy) {
    from configurations.compile.files {
         println("it: " + it)
        println("it.artifacts: " + it.artifacts)
        it instanceof ExternalModuleDependency && it.artifacts.every { it.classifier == 'natives-windows' }
    }
     into "$buildDir/natives/windows"
}

```

My output ends up looking like this:

it: DefaultExternalModuleDependency{group=‘org.lwjgl.lwjgl’, name=‘lwjgl’, version=‘2.8.2’, configuration=‘default’} it.artifacts: [] it: DefaultExternalModuleDependency{group=‘org.lwjgl.lwjgl’, name=‘lwjgl’, version=‘2.8.2’, configuration=‘default’} it.artifacts: [] :copyNativesWindows

BUILD SUCCESSFUL

My guess as to why all these files are being copied is that every one of the artifacts pass the classifier comparison, since there seem to be no artifacts to run the comparison against. I’m not sure why it seems as though the closure is being called twice. Clearly I’m doing something wrong, but I’m not sure what. Could do me the favor of posting your build.gradle for me to examine? Any additional advice would be welcome.

---

_[View the full topic](https://discuss.gradle.org/t/how-to-use-lwjgl-or-how-to-use-native-libraries/7498)._
