Where/how to get the MSVC dlls Java 1.8.0_144 want

2019-08-25 03:41发布

问题:

I'm experimenting with building my application with Java 1.8.0_144 to workaround an issue that apparently started after that. I run this command to build:

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

and it stops with this error:

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

Where and how do I get these MSVC dlls?

The full output looks like this:

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

My current list of dependencies look like this:

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"
}

I tried adding

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

to that list but I'm still getting the same error when trying to build the installer.

Adding it to my buildscript dependencies did not change the error either:

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"
    }
}

回答1:

You need to install Microsoft Visual C++ redistribute package

In any case this is better solution to build JNA from source code using Visual studio 17, which is using universal CRT so that you don't need to ask your user to install it, since it is already installed by Windows update service.