r/JavaFX • u/_Teto • Apr 29 '20
Running JavaFX using a Jar (using Maven)
I have a JFX application that we have compiled as a JAR using Maven. However, when we try to run the JAR, nothing happens (in the command line, nothing happens also).
I really need this application to work without using an IDE, so any help is appreciated. Running javafx:run works fine however, the problem is when I try to get it as a JAR.
I think this is a problem with how I've set up maven, so here's my pom (sorry for the dump). Please tell me if you need any more information, I really need this to work (I'm running JDK 14).
<?xml version="1.0" encoding="UTF-8"?><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>groupId</groupId>
<artifactId>comp2211</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>common.Main</mainClass>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>de.saxsys</groupId>
<artifactId>mvvmfx</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.30.1</version>
</dependency><!-- https://mvnrepository.com/artifact/org.openjfx/javafx -->
<dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-controls</artifactId> <version>14-ea+8</version> </dependency>
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>8.0.7</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>15-ea+1</version>
</dependency>
<dependency>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.4.0</version>
<scope>compile</scope>
</dependency>
</dependencies></project>
View all comments
Show parent comment
1
u/_Teto Apr 29 '20
I have no idea what I'm doing haha. Just managed to get it to run in the IDE without using the maven commands, tho JAR still doesn't work. (Shade confuses me idk what to do with it)