我刚刚在 Windows 7 计算机上安装了 Gradle 2.11,当我运行 gradle -v 时,我收到一条失败消息。Gradle 位于路径中并且 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
Run Code Online (Sandbox Code Playgroud)
这是由 Windows 配置引起的,可能是通过组策略引起的。文件 native-platform.dll 是从 JAR 文件之一中提取的,可能放置在用户主目录的文件夹中,例如 c:\Users\%USERNAME%\Local Settings\Temp。对于恶意软件防护,可以禁用从 TMP 目录加载 DLL 和执行程序。
我遇到了相同症状的问题,在某些情况下我可以通过将 TEMP 和 TMP 环境变量设置为指向用户目录之外(例如 c:\tmp)来解决该问题。这不是一个通用的解决方案,并且不适用于 gradle。通过将 GRADLE_OPTS 设置为指向所需的位置,可以覆盖 Gradle 提取 DLL 的位置。这可能对你有用:
C:\ mkdir C:\tmp
C:\ 设置 GRADLE_OPTS="-Dorg.gradle.native.dir=/tmp"
| 归档时间: |
|
| 查看次数: |
10523 次 |
| 最近记录: |