简体   繁体   中英

How do I deploy this JavaFX/Maven to a executable?

I have been working on a desktop app using javafx and maven, in this project i also use apache poi to read some excels and h2 database to make a temporary database. I have been able to make it run perfectly in intellij idea, but i can't for the life of me deploy it in .jar and run it outside of the idea.I tried doing it using javfx:jlink but it fails with this error: error

Here also a link for the repository in github: github repository

Please thats the only thing left to do.Any help is appreciated.

As far I know you're able to use fat-jar to bring all dependencies with your application and pack it into single fat-ultrasomma.jar file.

You'll run the app by using the next command:

$ java -jar target/fat-ultrasomma.jar

To do that you need to add a shade plugin

<build>
        <plugins>
           ...
           ...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <finalName>fat-ultrasomma</finalName>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>ultrasomma.Main</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

And a Main.java class for execution

public class Main {
    public static void main(String[] args) {
        App.main(args);
    }
}

Links:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM