0

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"
    }
}
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
  • Where have you find javafx-gradle-plugin version 8.8.2 the last one stabile is 8.8.0 according to the [releases](https://github.com/FibreFoX/javafx-gradle-plugin/releases). Please downgrade the plugin version. – Victor Gubin Apr 03 '18 at 12:11
  • Generally I get my libraries from Maven central: https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22de.dynamicfiles.projects.gradle.plugins%22%20AND%20a%3A%22javafx-gradle-plugin%22 – Pablo Fernandez Apr 03 '18 at 12:36
  • You probably already ensured that to requirements mentioned in the gradle plugin‘s page are fulfilled?! As the javafx gradle plugin seems to be a wrapper for javapackager only you should check this requirements as well. – dpr Apr 03 '18 at 19:44
  • @dpr: I'm sorry, what requirement? – Pablo Fernandez Apr 03 '18 at 20:38
  • The plugin‘s [github page](https://github.com/FibreFoX/javafx-gradle-plugin/blob/newyear2018release/README.md) mentions some OS specific requirements. It also links the [official documentation of javapackager](https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html#A1324980) where the requirements are explained in more detail. Eg inno setup needs to be installed and available on the path. – dpr Apr 03 '18 at 20:42
  • @dpr: oh... yes. I have those. javafxpackager wouldn't do much without them and I'm successfully packaging this app with other versions of the JVM. – Pablo Fernandez Apr 03 '18 at 20:44

1 Answers1

0

Maintainer of the javafx-maven-plugin/Author of the javafx-gradle-plugin here!

Even if this is a very old post, and I did not see this one before (sorry), I might have an answer to this issue. And it happens even today.

While debugging an issue on the plugin (https://github.com/javafx-maven-plugin/javafx-maven-plugin/issues/395) I found that sometimes there are 2 files missing inside the JDK itself.

In case someone has installed any non-Oracle JDK, e.g. OpenLogic, the provided files are incomplete.

The JDK provided by OpenLogic (other others) provides a file called ant-javafx.jar, where all the system native files are contained (can be found inside the installed JDK in the lib-folder). That file is missing the required runtime files, that are required by the launcher.

Here a screenshot of what it looks like with OracleJDK:

content of Oracle JDK file

Here a screenshot of what it looks with OpenLogic JDK:

content of OpenLogic JDK

As you can see, there are files missing in there, which makes that JDK not equivalent to the OracleJDK sadly.

On maven-plugin level I can not do anything here to fix this, but you might be able to fix that by modifying that JAR-file by adding the missing files. You should be able to find them on your local windows installation at C:\Windows\System32\vcruntime140.dll or C:\Windows\System32\msvcp140.dll. If these files are missing, you just can download a official runtime installer of these Visual C++ Redistributable files here:

Another alternative would be to install a different OpenJDK, for example ojdkbuild (https://github.com/ojdkbuild/ojdkbuild). Using chocolatey on Windows just makes this a one-liner choco install ojdkbuild8 and does contain these required files.

FibreFoX
  • 2,858
  • 1
  • 19
  • 41