0

I have aplication build with Maven, JavaFX 20, JDK 17

I'm trying to use mapjfx from sothawo and JavaFXApplicationAutoUpdater from goxr3plus, and it works on my IDE, But when I build an exe installer with jpackage and WixToolset, my aplication can't connect with Internet, maps window are opening but not loading, there is a gray background, and in updater there is a problem with "URLConnection connection = remoteResourceLocation.get().openConnection();" it returns me a null, when I have String downloadURL with normal URL like ""https://github.com/....", but it works with URL that starts like this: "file://\\192.168.2.22\....."

Currently I'm using mapjfx and JavaFXApplicationAutoUpdater as my local files to exclude problem with external libraries.

I think that I have bad POM or bad jpackage command, but I can't find where.

My POM:

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>company</groupId>
    <artifactId>NowyTerminal</artifactId>
    <version>1.6</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <javafx.version>17</javafx.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>20.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>20.0.1</version>
        </dependency>
        <dependency>
            <groupId>javax.resource</groupId>
            <artifactId>connector-api</artifactId>
            <version>1.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.formdev</groupId>
            <artifactId>flatlaf</artifactId>
            <version>3.0</version>

        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.14.1</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.14.1</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.14.1</version>
        </dependency>
        <dependency>
            <groupId>org.clojure</groupId>
            <artifactId>java.jdbc</artifactId>
            <version>0.7.12</version>
        </dependency>
        <dependency>
            <groupId>org.firebirdsql.jdbc</groupId>
            <artifactId>jaybird</artifactId>
            <version>5.0.0.java8</version>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>31.1-jre</version>

        </dependency>
        <dependency>
            <groupId>org.controlsfx</groupId>
            <artifactId>controlsfx</artifactId>
            <version>11.1.2</version>

        </dependency>

             <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-graphics</artifactId>
            <version>20.0.1</version>

        </dependency>
           <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-media</artifactId>
            <version>20.0.1</version>

        </dependency>
               <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-web</artifactId>
            <version>20.0.1</version>

        </dependency>
        <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.13.0</version>
</dependency>
    </dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.5.0</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                         <release>17</release> <!-- Specify your Java version -->
                <source>17</source>
                <target>17</target>
                     <finalName>NowyTerminal</finalName>
                        <createDependencyReducedPom>false</createDependencyReducedPom>
                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>core.NewFXMain</mainClass> <!-- Specify your main class -->
                            </transformer>
                        </transformers>
                         <compilerArgs>
                        <arg>--add-exports</arg>
                        <arg>javafx.graphics/com.sun.javafx.application=ALL-UNNAMED</arg>
                        <arg>--add-exports</arg>
                        <arg>javafx.base/com.sun.javafx.event=ALL-UNNAMED</arg>
                        <arg>-Client</arg>
                        <arg>-XX:CompileThreshold=1000</arg>
                    </compilerArgs>
                    </configuration>
                </execution>
            </executions>
        </plugin>
         <plugin>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-maven-plugin</artifactId>
        <version>0.0.8</version>
        <configuration>
            <mainClass>core.NewFXMain</mainClass>
            <launcher>NowyTerminal</launcher>
        </configuration>
    </plugin>
    </plugins>
</build>
    <name>NowyTerminal</name>
</project>

My jpackage command:

jpackage --type exe --input . --dest . --main-jar .\NowyTerminal.jar --main-class core.NewFXMain --module-path "C:\Program Files\Java\javafx-jmods-20" --add-modules javafx.controls,javafx.fxml --add-exports javafx.base/com.sun.javafx.event=ALL-UNNAMED --win-shortcut --win-menu --icon "icon.ico" --name "NowyTerminal"

Dawid
  • 1
  • 1

0 Answers0