【问题标题】:Where/how to get the MSVC dlls Java 1.8.0_144 wants?在哪里/如何获得 Java 1.8.0_144 想要的 MSVC dll?
【发布时间】:2018-04-03 10:47:49
【问题描述】:

我正在尝试使用 Java 1.8.0_144 构建我的应用程序以解决 an issue that apparently started after that。我运行这个命令来构建:

gradle jfxNative -Dorg.gradle.java.home="c:\Program Files\Java\jdk1.8.0_144"

它会因为这个错误而停止:

Execution failed for task ':jfxNative'.
> Not found MSVC dlls

我在哪里以及如何获得这些 MSVC dll?

完整的输出如下所示:

c:\...\>gradle jfxNative -Dorg.gradle.java.home="c:\Program Files\Java\jdk1.8.0_144"

> Task :jfxNative 
The jar lib\lombok-1.16.18.jar has a main class lombok.launch.Main that does not match the declared main tech.dashman.dashman.ConfiguratorApp
The jar lib\jna-4.5.0.jar has a main class com.sun.jna.Native that does not match the declared main tech.dashman.dashman.ConfiguratorApp
The jar lib\javassist-3.22.0-CR2.jar has a main class javassist.CtClass that does not match the declared main tech.dashman.dashman.ConfiguratorApp


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jfxNative'.
> Not found MSVC dlls

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 8s
5 actionable tasks: 2 executed, 3 up-to-date

我当前的依赖列表如下所示:

dependencies {
    compile "tech.dashman:dashmancommon:1.0.0-SNAPSHOT"
    compile "org.projectlombok:lombok:1.16.18"
    compile "org.springframework:spring-web:5.0.2.RELEASE"
    compile "org.springframework.retry:spring-retry:1.2.2.RELEASE"
    compile "com.fasterxml.jackson.core:jackson-databind:2.9.3"
    compile "org.kordamp.ikonli:ikonli-javafx:2.1.0"
    compile "org.kordamp.ikonli:ikonli-fontawesome5-pack:2.1.1"
    compile "net.harawata:appdirs:1.0.1"
    compile "io.sentry:sentry:1.6.4"
    compile "org.javassist:javassist:3.22.0-CR2"
    testCompile "junit:junit:4.12"
}

我尝试添加

compile "net.java.dev.jna:jna-platform:4.5.1"

到那个列表,但我在尝试构建安装程序时仍然遇到同样的错误。

将它添加到我的buildscript dependencies 也没有改变错误:

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath "de.dynamicfiles.projects.gradle.plugins:javafx-gradle-plugin:8.8.2"
        classpath "com.github.ben-manes:gradle-versions-plugin:0.17.0"
        classpath "de.dynamicfiles.projects.javafx.bundler:custom-file-extension-windows-bundler:1.0.2-SNAPSHOT"
        classpath "net.java.dev.jna:jna-platform:4.5.1"
    }
}

【问题讨论】:

  • 你在哪里找到 javafx-gradle-plugin 版本 8.8.2 根据releases,最后一个稳定版是 8.8.0。请降级插件版本。
  • 通常我从 Maven 中心获取我的库:search.maven.org/…
  • 您可能已经确保满足 gradle 插件页面中提到的要求?!由于 javafx gradle 插件似乎只是 javapackager 的包装器,因此您也应该检查此要求。
  • @dpr:对不起,什么要求?
  • 插件的github page 提到了一些操作系统特定的要求。它还链接了official documentation of javapackager,其中更详细地解释了要求。例如,需要安装 inno 设置并在路径上可用。

标签: java visual-c++ dll


【解决方案1】:

javafx-maven-plugin 的维护者/javafx-gradle-plugin 的作者在这里!

即使这是一篇很老的帖子,而且我以前没有看过这个(抱歉),我可能对这个问题有一个答案。即使在今天,它也会发生。

在调试插件 (https://github.com/javafx-maven-plugin/javafx-maven-plugin/issues/395) 上的问题时,我发现有时 JDK 本身内部缺少 2 个文件。

如果有人安装了任何非 Oracle JDK,例如OpenLogic,提供的文件不完整。

OpenLogic(其他)提供的 JDK 提供了一个名为 ant-javafx.jar 的文件,其中包含所有系统原生文件(可以在已安装的 JDK 中的 lib 文件夹中找到)。该文件缺少启动器所需的运行时文件。

这里是 OracleJDK 的截图:

这里是 OpenLogic JDK 的截图:

如您所见,其中缺少文件,这使得 JDK 不等同于 OracleJDK。

在 maven-plugin 级别上,我无法在此处做任何事情来解决此问题,但您可以通过添加丢失的文件来修改该 JAR 文件来解决此问题。您应该能够在C:\Windows\System32\vcruntime140.dllC:\Windows\System32\msvcp140.dll 的本地Windows 安装中找到它们。如果这些文件丢失,您可以在这里下载这些 Visual C++ Redistributable 文件的官方运行时安装程序:

另一种选择是安装不同的 OpenJDK,例如 ojdkbuild (https://github.com/ojdkbuild/ojdkbuild)。在 Windows 上使用 Chocolatey 只会使其成为单行 choco install ojdkbuild8 并且确实包含这些必需的文件。

【讨论】:

    猜你喜欢
    • 2012-03-08
    • 1970-01-01
    • 2020-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-21
    • 2021-12-14
    相关资源
    最近更新 更多