Can't Run Gradle on Corporate Windows 7


(Wes Strater) #1

I am having a similar experience as this issue in the old forum. I am trying to run Gradle on a corporate Windows 7 machine and keep getting JNA errors. Here is the command I am running.

C:\dev\tools>"C:\Program Files\Java\jdk1.7.0_55\bin\java.exe" -Dorg.gradle.native=false -Dorg.gradle.appname=gradle -classpath C:\dev\tools\gradle-2.3\lib\gradle-launcher-2.3.jar org.gradle.launcher.GradleMain -v --debug --stacktrace
12:33:37.334 [ERROR] [org.gradle.BuildExceptionReporter]
12:33:37.334 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
12:33:37.334 [ERROR] [org.gradle.BuildExceptionReporter]
12:33:37.334 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
12:33:37.334 [ERROR] [org.gradle.BuildExceptionReporter] com.sun.jna.Native.sizeof(I)I
12:33:37.350 [ERROR] [org.gradle.BuildExceptionReporter]
12:33:37.350 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
12:33:37.350 [ERROR] [org.gradle.BuildExceptionReporter] java.lang.UnsatisfiedLinkError: com.sun.jna.Native.sizeof(I)I
12:33:37.350 [ERROR] [org.gradle.BuildExceptionReporter]        at com.sun.jna.Native.sizeof(Native Method)
12:33:37.350 [ERROR] [org.gradle.BuildExceptionReporter]        at com.sun.jna.Native.<clinit>(Native.java:110)
12:33:37.350 [ERROR] [org.gradle.BuildExceptionReporter]        at org.fusesource.jansi.internal.Kernel32.<clinit>(Kernel32.java:33)
12:33:37.350 [ERROR] [org.gradle.BuildExceptionReporter]        at org.fusesource.jansi.WindowsAnsiOutputStream.<clinit>(WindowsAnsiOutputStream.java:47)
12:33:37.365 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.internal.nativeplatform.console.WindowsConsoleDetector.getConsole(WindowsConsoleDetector.java:28)
12:33:37.365 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:32)
12:33:37.365 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:27)
12:33:37.365 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.logging.internal.OutputEventRenderer.attachConsole(OutputEventRenderer.java:68)
12:33:37.365 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.logging.internal.DefaultLoggingManager.attachConsole(DefaultLoggingManager.java:146)
12:33:37.365 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:168)
12:33:37.365 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
12:33:37.365 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
12:33:37.365 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
12:33:37.365 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.Main.doAction(Main.java:46)
12:33:37.365 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
12:33:37.365 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.Main.main(Main.java:37)
12:33:37.381 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
12:33:37.381 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
12:33:37.381 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
12:33:37.381 [ERROR] [org.gradle.BuildExceptionReporter]

My user owns the Gradle directory and has full permissions.

The /dev/tools directory is proper location for installing development tools based on the policy.

I get similar errors when running prior versions of Gradle including 1.12.

Moving Gradle to other directories does not help.

I can run the same command successfully as an administrator but I can not develop as an administrator.

Tried installing the wrapper as an administrator but my user can’t run gradlew. Same error.

Any help would be appreciated.

Thanks, Wes.


(Wes Strater) #2

I am still having an issue. This time I am trying to use the Gradle 2.7 wrapper.

C:\Users\wstrater\Projects\mobile-rest-poc>set DEBUG=ON

C:\Users\wstrater\Projects\mobile-rest-poc>gradlew --debug --stacktrace tasks
C:\Users\wstrater\Projects\mobile-rest-poc>if "Win7" == "Windows_NT" setlocal
C:\Users\wstrater\Projects\mobile-rest-poc>set DEFAULT_JVM_OPTS=
C:\Users\wstrater\Projects\mobile-rest-poc>set DIRNAME=C:\Users\wstrater\Projects\mobile-rest-poc\
C:\Users\wstrater\Projects\mobile-rest-poc>if "C:\Users\wstrater\Projects\mobile-rest-poc\" == "" set DIRNAME=.
C:\Users\wstrater\Projects\mobile-rest-poc>set APP_BASE_NAME=gradlew
C:\Users\wstrater\Projects\mobile-rest-poc>set APP_HOME=C:\Users\wstrater\Projects\mobile-rest-poc\
C:\Users\wstrater\Projects\mobile-rest-poc>if defined JAVA_HOME goto findJavaFromJavaHome
C:\Users\wstrater\Projects\mobile-rest-poc>set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_45
C:\Users\wstrater\Projects\mobile-rest-poc>set JAVA_EXE=C:\Program Files\Java\jdk1.8.0_45/bin/java.exe
C:\Users\wstrater\Projects\mobile-rest-poc>if exist "C:\Program Files\Java\jdk1.8.0_45/bin/java.exe" goto init
C:\Users\wstrater\Projects\mobile-rest-poc>if not "Win7" == "Windows_NT" goto win9xME_args
C:\Users\wstrater\Projects\mobile-rest-poc>set CMD_LINE_ARGS=
C:\Users\wstrater\Projects\mobile-rest-poc>set _SKIP=2
C:\Users\wstrater\Projects\mobile-rest-poc>if "x--debug" == "x" goto execute
C:\Users\wstrater\Projects\mobile-rest-poc>set CMD_LINE_ARGS=--debug --stacktrace tasks
C:\Users\wstrater\Projects\mobile-rest-poc>goto execute
C:\Users\wstrater\Projects\mobile-rest-poc>set CLASSPATH=C:\Users\wstrater\Projects\mobile-rest-poc\\gradle\wrapper\gradle-wrapper.jar
C:\Users\wstrater\Projects\mobile-rest-poc>"C:\Program Files\Java\jdk1.8.0_45/bin/java.exe"    "-Dorg.gradle.appname=gradlew" -classpath "C:\Users\wstrater\Projects\mobile-rest-poc\\gradle\wrapper\gradle-wrapper.jar" org.gradle.wrapper.GradleWrapperMain --debug --stacktrace tasks
13:22:20.409 [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
13:22:20.471 [ERROR] [org.gradle.BuildExceptionReporter]
13:22:20.471 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
13:22:20.487 [ERROR] [org.gradle.BuildExceptionReporter]
13:22:20.487 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
13:22:20.487 [ERROR] [org.gradle.BuildExceptionReporter] com.sun.jna.Native.sizeof(I)I
13:22:20.502 [ERROR] [org.gradle.BuildExceptionReporter]
13:22:20.502 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
13:22:20.518 [ERROR] [org.gradle.BuildExceptionReporter] java.lang.UnsatisfiedLinkError: com.sun.jna.Native.sizeof(I)I
13:22:20.518 [ERROR] [org.gradle.BuildExceptionReporter]        at com.sun.jna.Native.sizeof(Native Method)
13:22:20.518 [ERROR] [org.gradle.BuildExceptionReporter]        at com.sun.jna.Native.(Native.java:110)
13:22:20.534 [ERROR] [org.gradle.BuildExceptionReporter]        at org.fusesource.jansi.internal.Kernel32.(Kernel32.java:33)
13:22:20.549 [ERROR] [org.gradle.BuildExceptionReporter]        at org.fusesource.jansi.WindowsAnsiOutputStream.(WindowsAnsiOutputStream.java:47)
13:22:20.549 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.internal.nativeintegration.console.WindowsConsoleDetector.getConsole(WindowsConsoleDetector.java:28)
13:22:20.565 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:38)
13:22:20.580 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.logging.internal.ConsoleConfigureAction.execute(ConsoleConfigureAction.java:29)
13:22:20.596 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.logging.internal.OutputEventRenderer.attachProcessConsole(OutputEventRenderer.java:77)
13:22:20.596 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.logging.internal.DefaultLoggingManager.attachProcessConsole(DefaultLoggingManager.java:165)
13:22:20.612 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:204)
13:22:20.627 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
13:22:20.643 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
13:22:20.643 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
13:22:20.643 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.Main.doAction(Main.java:33)
13:22:20.643 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
13:22:20.643 [ERROR] [org.gradle.BuildExceptionReporter]        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:22:20.658 [ERROR] [org.gradle.BuildExceptionReporter]        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
13:22:20.658 [ERROR] [org.gradle.BuildExceptionReporter]        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
13:22:20.658 [ERROR] [org.gradle.BuildExceptionReporter]        at java.lang.reflect.Method.invoke(Method.java:497)
13:22:20.658 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
13:22:20.658 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
13:22:20.658 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
13:22:20.658 [ERROR] [org.gradle.BuildExceptionReporter]        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:22:20.658 [ERROR] [org.gradle.BuildExceptionReporter]        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
13:22:20.674 [ERROR] [org.gradle.BuildExceptionReporter]        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
13:22:20.674 [ERROR] [org.gradle.BuildExceptionReporter]        at java.lang.reflect.Method.invoke(Method.java:497)
13:22:20.674 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
13:22:20.674 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
13:22:20.674 [ERROR] [org.gradle.BuildExceptionReporter]        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
13:22:20.674 [ERROR] [org.gradle.BuildExceptionReporter]
C:\Users\wstrater\Projects\mobile-rest-poc>if "1" == "0" goto mainEnd
C:\Users\wstrater\Projects\mobile-rest-poc>rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
C:\Users\wstrater\Projects\mobile-rest-poc>rem the _cmd.exe /c_ return code!
C:\Users\wstrater\Projects\mobile-rest-poc>if not "" == "" exit 1
C:\Users\wstrater\Projects\mobile-rest-poc>exit /b 1

C:\Users\wstrater\Projects\mobile-rest-poc>type gradle\wrapper\gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip

I recursively set the owner of my home directory, C:\Users\wstrater, to ensure I had ownership.

Any help please. I am trying to use Gradle but keep hitting a dead end.

Wes.


(Lari Hotari) #3

Another user was having a similar problem and found a workaround: Unable to initialize native-platform. Failure: net.rubygrapefruit.platform.NativeException: Failed to initialise native integration.


(Wes Strater) #4

The problem is I don’t know what is needed to relax permissions to allow Gradle to run. I am using the Gradle wrapper so I believe the directory is in my home directory. I have taken the sledge hammer approach and have recursively updated the ownership and granted full control.


(Adam Koch) #5

I came across the UnsatisfiedLinkError in my enterprise and fixed it by setting my Windows temp directory to a location that had the correct permissions to run executables.