I have a javaFX application and I want the user to be able to run it without a development environment, that is, just click on the jar file and work with the graphical application
public class RunFrame extends Application {
static Logger LOGGER;
static {
try(FileInputStream ins = new FileInputStream("src/main/resources/log.config")) {
LogManager.getLogManager().readConfiguration(ins);
LOGGER = Logger.getLogger(RunFrame.class.getName());
} catch (IOException e) {
LOGGER.log(Level.WARNING,"Error ", e);
}
}
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
try {
FXMLLoader loader = new FXMLLoader();
URL xmlUrl = getClass().getResource("/RunFrameScene.fxml");
loader.setLocation(xmlUrl);
Parent root = loader.load();
stage.setTitle("App");
stage.getIcons().add(new Image(RunFrame .class.getClassLoader().getResourceAsStream("logo.png")));
stage.setScene(new Scene(root));
stage.show();
LOGGER.log(Level.INFO,"Success ");
} catch (Exception e) {
LOGGER.log(Level.SEVERE,"Error", e);
}
}
}
The class through which the application is launched
public class FrameRunApp {
static Logger LOGGER;
static {
try(FileInputStream ins = new FileInputStream("src/main/resources/log.config")){
LogManager.getLogManager().readConfiguration(ins);
LOGGER = Logger.getLogger(FrameRunApp .class.getName());
}catch (Exception e){
LOGGER.log(Level.WARNING,"Error ", e);
}
}
public static void main(String[] args) {
FrameRunApp.main(args);
}
}
Also I have a pom.xml file
<?xml version='1.0'?>
<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>
<parent>
<groupId>org.apache.activemq.examples.broker</groupId>
<artifactId>jms-examples</artifactId>
<version>2.27.1</version>
</parent>
<artifactId>jmx</artifactId>
<packaging>jar</packaging>
<name>FrameApplication</name>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.36</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx-controls -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>19</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx-fxml -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>19</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>3.0.5</version>
</dependency>
</dependencies>
</project>
I don't really understand how to create a jar file and just run the app's application on it, rather than by designing run the app's launcher method.