1 year ago

#375527

test-img

Reinvert

Exported JavaFX Application file size is too big

I have my own project(https://github.com/reinvert/CrossStitchConverter)

And I always compile the project on eclipse by File-Export-Runnable JAR File-(Library handling)Package required libraries into generated JAR.

It works fine, but the jar file size is too big(83.0MB)

How can I reduce the file size?

I tried jlink, jpackage, and etc, but none of those have an effect.

This is my pom.xml file

<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>CrossStitchConverter</groupId>
    <artifactId>CrossStitchConverter</artifactId>
    <version>1</version>
    <build>
        <defaultGoal>install</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.8</version>
                <configuration>
                    <mainClass>CrossStitchConverter</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>17.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>io.github.palexdev</groupId>
            <artifactId>materialfx</artifactId>
            <version>11.13.3</version>
        </dependency>
    </dependencies>
</project>

I found large library file(JavaFX-web-17.0.2-linux.jar and JavaFX-web-17.0.2-win.jar, which is total 50MB) in exported jar file, so I deleted these file and tried to run jar file, it worked. I think other unused jar library can be removed as those, but I can't find an option for it.

java

eclipse

javafx

jlink

jpackage

0 Answers

Your Answer

Accepted video resources