I going to create a runnable JAR file inside Eclipse IDE. All my dependencies are from Maven. In Eclipse I'm creating a JavaFX GUI application for desktop.
The problem is that when I creating the runnable JAR file. I got this error.
The error is very clear.
Jar export finished with problems. See details for additional information. Could not find main method from given launch configuration.
But what is main method? Is it the public static void main(String[] args)
method here?
What should I do to solve this?
package se.danielmartensson.start;
import java.util.Optional;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonType;
import javafx.stage.Stage;
import se.danielmartensson.concurrency.Measureing;
public class Main extends Application{
/*
* Start the start(Stage front)
*/
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage front) throws Exception {
front.setOnCloseRequest(e->{
e.consume();
askForClosing();
});
Parent root = FXMLLoader.load(getClass().getResource("/se/danielmartensson/fxml/front.fxml"));
Scene scene = new Scene(root);
front.setScene(scene);
front.setTitle("JUBSPlotter");
front.show();
}
private void askForClosing() {
Alert question = new Alert(AlertType.CONFIRMATION);
question.setTitle("Closing");
question.setHeaderText("Do you want to close?");
question.setResizable(false);
question.setContentText("Press OK to close.");
Optional<ButtonType> answer = question.showAndWait();
if(answer.get() == ButtonType.OK) {
Measureing.active = false;
Platform.exit();
}
}
}