# Unable to initialize native-platform. Failure: net.rubygrapefruit.platform.NativeException: Failed to initialise native integration.

**URL:** <https://discuss.gradle.org/t/unable-to-initialize-native-platform-failure-net-rubygrapefruit-platform-nativeexception-failed-to-initialise-native-integration/2391>\
**Category:** Old Forum Archive\
**Created:** [February 25, 2015, 10:29pm UTC](https://discuss.gradle.org/t/unable-to-initialize-native-platform-failure-net-rubygrapefruit-platform-nativeexception-failed-to-initialise-native-integration/2391 "2015-02-25T22:29:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scott\_Steimle](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@Scott\_Steimle](https://discuss.gradle.org/u/Scott_Steimle)\
**Post date:** [February 25, 2015, 10:29pm UTC](https://discuss.gradle.org/t/unable-to-initialize-native-platform-failure-net-rubygrapefruit-platform-nativeexception-failed-to-initialise-native-integration/2391/1 "2015-02-25T22:29:00Z")

</div>

On Windows-7 using fresh gradle 2.3 install. GRADLE\_HOME is set. GRADLE\_USER\_HOME setting is irrelevant:

$ gradle -v --debug --stacktrace

16:17:57.747 [DEBUG] [org.gradle.internal.nativeintegration.services.NativeServices] Unable to initialize native-platform. Failure: net.rubygrapefruit.platform.NativeException: Failed to initialise native integration. caused by: java.lang.UnsatisfiedLinkError: net.rubygrapefruit.platform.internal.jni.NativeLibraryFunctions.getVersion()I 16:17:57.772 [ERROR] [org.gradle.BuildExceptionReporter] 16:17:57.775 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception. 16:17:57.775 [ERROR] [org.gradle.BuildExceptionReporter] 16:17:57.775 [ERROR] [org.gradle.BuildExceptionReporter] \* What went wrong: 16:17:57.776 [ERROR] [org.gradle.BuildExceptionReporter] com.sun.jna.Native.sizeof(I)I 16:17:57.776 [ERROR] [org.gradle.BuildExceptionReporter] 16:17:57.777 [ERROR] [org.gradle.BuildExceptionReporter] \* Exception is: 16:17:57.777 [ERROR] [org.gradle.BuildExceptionReporter] java.lang.UnsatisfiedLinkError: com.sun.jna.Native.sizeof(I)I 16:17:57.778 [ERROR] [org.gradle.BuildExceptionReporter]

at com.sun.jna.Native.sizeof(Native Method) 16:17:57.778 [ERROR] [org.gradle.BuildExceptionReporter]

at com.sun.jna.Native.(Native.java:110) 16:17:57.778 [ERROR] [org.gradle.BuildExceptionReporter]

at org.fusesource.jansi.internal.Kernel32.(Kernel32.java:33) 16:17:57.778 [ERROR] [org.gradle.BuildExceptionReporter]

at org.fusesource.jansi.WindowsAnsiOutputStream.(WindowsAnsiOutputStream.java:47) 16:17:57.779 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.internal.nativeintegration.console.WindowsConsoleDetector.getConsole(WindowsConsoleDetector.java:28) 16:17:57.779 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:38) 16:17:57.779 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:29) 16:17:57.779 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.logging.internal.OutputEventRenderer.attachProcessConsole(OutputEventRenderer.java:75) 16:17:57.779 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.logging.internal.DefaultLoggingManager.attachProcessConsole(DefaultLoggingManager.java:163) 16:17:57.780 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:204) 16:17:57.780 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169) 16:17:57.780 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) 16:17:57.780 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) 16:17:57.781 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.launcher.Main.doAction(Main.java:33) 16:17:57.781 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) 16:17:57.781 [ERROR] [org.gradle.BuildExceptionReporter]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 16:17:57.781 [ERROR] [org.gradle.BuildExceptionReporter]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 16:17:57.782 [ERROR] [org.gradle.BuildExceptionReporter]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 16:17:57.782 [ERROR] [org.gradle.BuildExceptionReporter]

at java.lang.reflect.Method.invoke(Method.java:606) 16:17:57.782 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54) 16:17:57.782 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35) 16:17:57.782 [ERROR] [org.gradle.BuildExceptionReporter]

at org.gradle.launcher.GradleMain.main(GradleMain.java:23) 16:17:57.783 [ERROR] [org.gradle.BuildExceptionReporter]

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [March 3, 2015, 4:53am UTC](https://discuss.gradle.org/t/unable-to-initialize-native-platform-failure-net-rubygrapefruit-platform-nativeexception-failed-to-initialise-native-integration/2391/2 "2015-03-03T04:53:00Z")

</div>

Hi Scott,

This is pretty strange. The fact that it’s failing to find a JDK class ‘com.sun.jna.Native.sizeof(I)I’ points to your environment being pretty messed up.

Are you doing anything custom that might contribute to this? How did you install the JDK?

---

<div class="post-metadata">

**Author:** ![Scott\_Steimle](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@Scott\_Steimle](https://discuss.gradle.org/u/Scott_Steimle)\
**Post date:** [March 3, 2015, 3:45pm UTC](https://discuss.gradle.org/t/unable-to-initialize-native-platform-failure-net-rubygrapefruit-platform-nativeexception-failed-to-initialise-native-integration/2391/3 "2015-03-03T15:45:00Z")

</div>

I’ve been running Java 1.5, 1.6, 1.7 (default), and 1.8 on my PC for 2 years and have no other issues. I’m not sure what you mean by custom, but they were standard JDK installations. What is likely the issue is that corporate policy has access locked down on Windows 7 – for instance, installers have to be run in particular directories to succeed. But since this was just a download, unzip, and setting of environment variables, I didn’t expect such a complication.

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [March 3, 2015, 9:44pm UTC](https://discuss.gradle.org/t/unable-to-initialize-native-platform-failure-net-rubygrapefruit-platform-nativeexception-failed-to-initialise-native-integration/2391/4 "2015-03-03T21:44:00Z")

</div>

One possibility is that your administrators are blocking the use of JNA.  
  
Can you please check to see if your environment imposes the ‘jna.library.path’ JVM system property.

---

<div class="post-metadata">

**Author:** ![Scott\_Steimle](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@Scott\_Steimle](https://discuss.gradle.org/u/Scott_Steimle)\
**Post date:** [March 3, 2015, 9:57pm UTC](https://discuss.gradle.org/t/unable-to-initialize-native-platform-failure-net-rubygrapefruit-platform-nativeexception-failed-to-initialise-native-integration/2391/5 "2015-03-03T21:57:00Z")

</div>

In gradle.bat, I tried setting:

set DEFAULT\_JVM\_OPTS=-Djna.library.path=%GRADLE\_USER\_HOME%\native\jna\win32-amd64

where GRADLE\_USER\_HOME=C:\java\gradle-2.3

Same error.

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [March 3, 2015, 9:59pm UTC](https://discuss.gradle.org/t/unable-to-initialize-native-platform-failure-net-rubygrapefruit-platform-nativeexception-failed-to-initialise-native-integration/2391/6 "2015-03-03T21:59:00Z")

</div>

I don’t think ‘jna.library.path’ should be set at all.

---

<div class="post-metadata">

**Author:** ![Scott\_Steimle](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@Scott\_Steimle](https://discuss.gradle.org/u/Scott_Steimle)\
**Post date:** [March 3, 2015, 10:10pm UTC](https://discuss.gradle.org/t/unable-to-initialize-native-platform-failure-net-rubygrapefruit-platform-nativeexception-failed-to-initialise-native-integration/2391/7 "2015-03-03T22:10:00Z")

</div>

Sorry, I misunderstood. But it behaves the same either way.

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [March 3, 2015, 11:38pm UTC](https://discuss.gradle.org/t/unable-to-initialize-native-platform-failure-net-rubygrapefruit-platform-nativeexception-failed-to-initialise-native-integration/2391/8 "2015-03-03T23:38:00Z")

</div>

Can you try system the system property ‘org.gradle.native=false’ please.

---

<div class="post-metadata">

**Author:** ![Scott\_Steimle](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@Scott\_Steimle](https://discuss.gradle.org/u/Scott_Steimle)\
**Post date:** [March 4, 2015, 3:09pm UTC](https://discuss.gradle.org/t/unable-to-initialize-native-platform-failure-net-rubygrapefruit-platform-nativeexception-failed-to-initialise-native-integration/2391/9 "2015-03-04T15:09:00Z")

</div>

Command line:

> “C:\Program Files\Java\jdk1.7.0\_45/bin/java.exe” “-Dorg.gradle.native=false”

“-Dorg.gradle.appname=gradle” -classpath “C:\java\gradle-2.3\bin..\lib\gradle-launcher-2.3.jar” org.gradle.launcher.GradleMain -v --debug --stacktrace

Result:

```gradle
FAILURE: Build failed with an exception.
  * What went wrong:
com.sun.jna.Native.sizeof(I)I
  * Exception is:
java.lang.UnsatisfiedLinkError: com.sun.jna.Native.sizeof(I)I
       at com.sun.jna.Native.sizeof(Native Method)
       at com.sun.jna.Native.<clinit>(Native.java:110)
       at org.fusesource.jansi.internal.Kernel32.<clinit>(Kernel32.java:33)
       at org.fusesource.jansi.WindowsAnsiOutputStream.<clinit>(WindowsAnsiOutputStream.java:47)
       at org.gradle.internal.nativeintegration.console.WindowsConsoleDetector.getConsole(WindowsConsoleDetector.java:28)
       at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:38)
       at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:29)
       at org.gradle.logging.internal.OutputEventRenderer.attachProcessConsole(OutputEventRenderer.java:75)
       at org.gradle.logging.internal.DefaultLoggingManager.attachProcessConsole(DefaultLoggingManager.java:163)
       at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:204)
       at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
       at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
       at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
       at org.gradle.launcher.Main.doAction(Main.java:33)
       at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:606)
       at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
       at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
       at org.gradle.launcher.GradleMain.main(GradleMain.java:23)

```

---

<div class="post-metadata">

**Author:** ![Scott\_Steimle](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@Scott\_Steimle](https://discuss.gradle.org/u/Scott_Steimle)\
**Post date:** [March 4, 2015, 6:54pm UTC](https://discuss.gradle.org/t/unable-to-initialize-native-platform-failure-net-rubygrapefruit-platform-nativeexception-failed-to-initialise-native-integration/2391/10 "2015-03-04T18:54:00Z")

</div>

I moved my gradle-2.3 folder to a directory with relaxed file system restrictions and it works now. I don’t know what specifically about the Windows 7 access control interfered, but at least I can work around it.
