Gradle exception Failed to load native-native-platform.dll library

I just installed Gradle 2.11 on a Windows 7 machine, and when I started Gradle -v, I got an error message. Gradle is on the way and there is a dll.

$ gradle -v --stacktrace FAILURE: Build failed with an exception. * What went wrong: Failed to load native library 'native-platform.dll' for Windows 7 amd64. * Try: Run with --info or --debug option to get more log output. * Exception is: net.rubygrapefruit.platform.NativeException: Failed to load native library 'nati ve-platform.dll' for Windows 7 amd64. at net.rubygrapefruit.platform.internal.NativeLibraryLoader.load(NativeL ibraryLoader.java:49) at net.rubygrapefruit.platform.Native.init(Native.java:55) at org.gradle.internal.nativeintegration.services.NativeServices.initial ize(NativeServices.java:74) at org.gradle.internal.nativeintegration.services.NativeServices.initial ize(NativeServices.java:60) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute( CommandLineActionFactory.java:203) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute( CommandLineActionFactory.java:169) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep ortingAction.java:33) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep ortingAction.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:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBoots trap.java:54) at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.j ava:35) at org.gradle.launcher.GradleMain.main(GradleMain.java:23) Caused by: java.io.IOException: The system cannot find the path specified at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:1012) at net.rubygrapefruit.platform.internal.NativeLibraryLocator.find(Native LibraryLocator.java:39) at net.rubygrapefruit.platform.internal.NativeLibraryLoader.load(NativeL ibraryLoader.java:41) ... 16 more 
+3
source share
2 answers

This is due to the configuration of Windows, possibly through Group Policy. The native-platform.dll file is extracted from one of the JAR files and is probably placed in a folder in the user's home directory, for example c: \ Users \% USERNAME% \ Local Settings \ Temp. To protect against malware, loading DLLs and executing programs from TMP directories can be disabled.

I have a problem with the same symptoms, and in some cases I managed to get around this by setting the TEMP and TMP environment variables outside the user's directory, for example c: \ tmp. This was not a universal solution and did not work for gradle. The location where Gradle retrieves the DLL can be overwritten by setting GRADLE_OPTS to indicate the desired location. This might work for you:

C: \ mkdir C: \ tmp

C: \ set GRADLE_OPTS = "- Dorg.gradle.native.dir = / tmp"

+3
source

In addition, you should put the given sentence in gradle.bat, located in the .. /gradle-2.11/bin folder.

Example:

 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS= set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME%.. @rem agregado por marcgaso set GRADLE_OPTS="-Dorg.gradle.native.dir=/tmp" **strong text** 
0
source

Source: https://habr.com/ru/post/1247734/


All Articles