Would really appreciate help here, please. I´m working on JavaFX application, first time. Tried to build standalone app. I´m not experienced, it´s first time what I see maven or other build tools. Before I build only small applications directly from Eclipse. I understand, that i have to pack other libraries (in maven as dependencies), "compile them", to one .jar file with my source codes. To farthest i got with maven and some .pom files. Tried many combinations of plugins and dependencies, but when i don´t fully understand what i´m doing, i´m always lost in it. Now I´m in state, that when run command in command promt (or build it as it in Eclipse with this goal)
mvn clean javafx:run
project is builded and my App is running. When I (in Eclipse) click on project right click -> Run As -> Maven Install (don´t know which command should I use in command prompt(javafx:install dont works)), It seems like my app compiled to .jar. But when i double click on that .jar, nothing happends. When I run it in command line (java UneccessaryFileCreator-0.0.1-SNAPSHOT.jar) i get error:
Error: Could not find or load main class UneccessaryFileCreator-0.0.1-SNAPSHOT.jar
Caused by: java.lang.ClassNotFoundException: UneccessaryFileCreator-0.0.1-SNAPSHOT.jar
Also I don´t see javafx dependencies in that .jar (when i browsing it in explorer) (but not sure, if i should see something there).
My project is here: https://github.com/JRulik/UneccessaryFileCreator
What is important i guess is structure of project: https://i.stack.imgur.com/aay1Y.png
this .pom 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>UneccessaryFileCreator</groupId>
<artifactId>UneccessaryFileCreator</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>17.0.1</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.6</version>
<executions>
<execution>
<!-- Default configuration for running -->
<!-- Usage: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>application.Main</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
and maybe mine main class? :
package application;
/**
* Main Class to init JAVAFX
* @author Adminator
*
*/
public class Main {
/**
* Main method, using lunch metod on GUIManager.class from JavaFX to run main JavaFX thread
* (this is made to not need to pass parameters to JVM and due to run .jar only from command line) <-it was not helpful
* @param args
*/
public static void main(String[] args) {
GUIManager.main(args);
}
}
-> created "fake" Main because i read somewhere, that for this build purpose Main class should not extend some extern library class. So my GUIManager extends Application. Please, would be really thankful for advice, spent last 2 days with this and still haven´t success. I choose maven because it looked like the easiest way. Using standalone plugins in command promt was too dificult for me. Would like to try another apps in JavaFX, but this releasing is really hell (or I´m also not brightest star on the sky)