Maven + Build Native with javafx-maven-plugin without JRE

I have a simple JavaFX application, and I want to create an installer for Windows machines. javafx-maven-plugin works and creates the application executable together with the Windows installer, but the problem is that it creates the Windows installer with the JavaFX application inside and the full JRE too.

So, how can I do to create my own files for Windows using javafx-maven-plugin , without having a complete Java structure. Perhaps he should only create a platform for the Java Framework. This inflates the installer from 1.5 MB to 200 MB of disk space.

With Maven, I use the mvn clean compile jfx:build-jar jfx:native to get my own files on Windows, and here is the POM file that I use:

 <?xml version="1.0"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.demo</groupId> <artifactId>hello-javafx-maven-example</artifactId> <name>JavaFX Example Maven Project</name> <organization> <name>Jaa Demo</name> </organization> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <build> <plugins> <plugin> <groupId>com.zenjava</groupId> <artifactId>javafx-maven-plugin</artifactId> <version>8.1.3</version> <configuration> <mainClass>com.demo.helloWorld</mainClass> </configuration> </plugin> </plugins> </build> </project> 
+4
source share
1 answer

I support this javafx-maven plugin.

When you create your installer, "by design", the JRE is part of your application. I also stumbled upon this, but despite the current oracle documentation, I found it impossible to run my generated files (using JDK 1.8u40 and higher, Windows) without this JRE aside from my own launcher. Packager.dll seems to require it to be there. But in order to be clear: this may just be a problem for me, and not test it and not research.

To answer your question: you can remove the JRE by passing a few bundleArguments arguments:

 <bundleArguments> <runtime /> </bundleArguments> 

I do it myself, mainly to speed up test projects, for example here: https://github.com/javafx-maven-plugin/javafx-maven-plugin/blob/master/src/it/03-cli-jfx-native /pom.xml#L31

EDIT: consider upgrading to version 8.1.5 of the plugin, as some bugs have been fixed, including a serious IMHO workaround for native launchers on Linux systems. There is also support for creating packages under the normal maven-lifecycle: https://github.com/javafx-maven-plugin/javafx-maven-plugin/blob/master/src/it/07-lifecycle-build-jfx-native/pom .xml

+5
source

All Articles