I have been trying to run my app with miglayout-javafx-5.2.jar, however every time I run the app, i get the an error, stating " Missing JavaFX application class application.Main".The screenshot in the link shows all the jar that i have downloaded. Thank you for your help! https://i.sstatic.net/IrLoN.png Below is my code:
import org.tbee.javafx.scene.layout.MigPane;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.*;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
try {
MigPane root = new MigPane();
Button b = new Button("Cick me");
root.add(b);
Scene scene = new Scene(root,400,400);
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
Error: "Missing JavaFX application class application.Main"
}
The jars i have downloaded for migpane are: miglayout-javafx-5.2.jar miglayout-core-5.2.jar I also have downloaded javafx in eclipse and it seems to work if i don't use migpane but when i use migpane i get the ERROR: "Missing JavaFX application class application.Main"
I've been having similar issues with JavaFX as well, since Java 11+. It's probably caused by your application not being a module.
As a workaround, try this:
import org.tbee.javafx.scene.layout.MigPane;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.*;
public class Main {
public static void main(String[] args) {
launch(MainApplication.class, args);
}
public static class MainApplication extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
MigPane root = new MigPane();
Button b = new Button("Cick me");
root.add(b);
Scene scene = new Scene(root, 400, 400);
primaryStage.setScene(scene);
primaryStage.show();
}
}
And then launch Main
.
Also: use an IDE and its code formatter, and stay away from e.printStackTrace()
:-)