0

I am running a simple javafx program on eclipse IDE. However, whenever I run my code, a launch error is displayed. There is no description of the error by the IDE and I am not sure what is causing that.

The image of the error is shown here

Also, I have e(fx)clipse and Gluon plugin installed. My code is very simple and I don't think that it is causing this error, however, I have attached it below for reference.

package application;
    
import Menus.MainMenu;
import javafx.application.Application;
import javafx.stage.Stage;

public class Main extends Application {
    @Override
    public void start(Stage primaryStage) {
        try {
            MainMenu mainMenu = new MainMenu();
            primaryStage = mainMenu.getMainStage();
            primaryStage.show();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        launch(args);
    }
}

Code for MainMenu is

package Menus;

import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

public class MainMenu {

    private static final int HEIGHT = 600;
    private static final int WIDTH = 800;
    private AnchorPane mainPane;
    private Scene mainScene;
    private Stage mainStage;

    public MainMenu() {
        mainPane = new AnchorPane();
        mainScene = new Scene(mainPane);
        mainStage = new Stage();
        mainStage.setScene(mainScene);
        mainStage.setFullScreen(true);
    }

    public Stage getMainStage() {
        return mainStage;
    }
}
Slaw
  • 37,820
  • 8
  • 53
  • 80
git
  • 1

1 Answers1

1
  1. Check the log file for the exact error and resolve it at : C:\app\eclipse\configuration\

  2. Check if the JRE is properly configured in eclipse as well as environment variables.

  3. Do not just click on the run button, check if you are running the proper program path by clicking on the arrow next to run. (This is a common problem with beginners)

  4. If you find everything else troublesome, try re-installing the IDE and running a simple hello world. If the problem persists, it is something to do with the environment variables or your eclipse setup.

Shashank Raj
  • 25
  • 1
  • 12