# Eclipse plugin native libraries

**URL:** <https://discuss.gradle.org/t/eclipse-plugin-native-libraries/1217>\
**Category:** Old Forum Archive\
**Created:** [July 8, 2014, 4:02pm UTC](https://discuss.gradle.org/t/eclipse-plugin-native-libraries/1217 "2014-07-08T16:02:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frank\_San\_Miguel](https://avatars.discourse-cdn.com/v4/letter/f/919ad9/32.png) [@Frank\_San\_Miguel](https://discuss.gradle.org/u/Frank_San_Miguel)\
**Post date:** [July 8, 2014, 4:02pm UTC](https://discuss.gradle.org/t/eclipse-plugin-native-libraries/1217/1 "2014-07-08T16:02:00Z")

</div>

Hi,

I’m building a project that requires the use of JNI (SQL Server Windows Authentication). I am using the application plugin and the eclipse plugin. I have everything working from the command line and from the install scripts, but I can’t figure out how to get the eclipse plugin to generate the correct build path (e.g. for “run as junit test” or “run as application”).

Anyone have suggestions?

Thanks, Frank

Here’s how eclipse wants it to look [![](https://sea1.discourse-cdn.com/gradle/uploads/default/694/4b2b5d10c0b0f460.png)](https://d2r1vs3d9006ap.cloudfront.net/s3_images/1074041/eclipse-native-library.png?1404835220)

Here’s the build script

```gradle
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'
  version = '4.0-SNAPSHOT'
mainClassName='com.db.WriteToDb'
    configurations { nativelib }
dependencies {
   testCompile 'junit:junit:4.11'
   runtime 'com.microsoft.sqljdbc:sqljdbc4:4.0.1'
 nativelib (group: 'com.microsoft.sqljdbc.auth.x64', name: 'sqljdbc_auth', version: '4.0.1', ext: 'dll')
}
  ext { nativeLibs = "$buildDir/nativeLibs" }
  task copyToLib << {
 def nativeLibs = file("$buildDir/nativeLibs")
 outputs.dir nativeLibs
 configurations.nativelib.resolvedConfiguration.resolvedArtifacts.each { artifact ->
  project.copy {
   from artifact.file
   into nativeLibs
   rename { "${artifact.name}.${artifact.extension}" }
  }
 }
}
  applicationDistribution.from(copyToLib) { into "nativeLibs" }
  test.dependsOn(copyToLib)
run.dependsOn(copyToLib)
tasks.withType(Test) { systemProperty "java.library.path", nativeLibs }
tasks.withType(JavaExec) { systemProperty "java.library.path", nativeLibs }
  startScripts { defaultJvmOpts = [
  "-Djava.library.path=../nativeLibs"
 ] }

```

---

<div class="post-metadata">

**Author:** ![daz](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/daz/32/2475_2.png) [@daz](https://discuss.gradle.org/u/daz)\
**Post date:** [July 25, 2014, 1:16am UTC](https://discuss.gradle.org/t/eclipse-plugin-native-libraries/1217/2 "2014-07-25T01:16:00Z")

</div>

You might be able to tweak the generated eclipse project file to do what you want. Check out the Eclipse chapter of the User Guide.
