javaeclipseexecutable-jarmanifest.mf

eclipse can't find main method when I make a jar


so I have the code made

package application;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;

public class main extends Application{
    public static void Main (String[] args){
        
    }
    @Override
    public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("title");
        Pane pain = (Pane) FXMLLoader.load(main.class.getResource("gui.fxml"));
        primaryStage.setScene(new Scene(pain));
        primaryStage.show();
        
        
    }
}

and it runs fine normally.

then I set up the configurations Main class: application.main project JRE jre1.8.0_251

and that runs just fine.

then I export/ Runnable JAR file select that launch configuration

export to C:\Users\clark\OneDrive\Documents\FRM.jar

Extract required libraries

hit finish and the following pops up

Jar export finished with problems. Could not find main method from given launch configuration.

MANIFEST.mf

Manifest-Version: 1.0
Main-Class: main
Created-By: 13.0.1 (Oracle Corporation)


Solution

  • Your main method is named wrong. Change

    public static void Main (String[] args)
    

    to

    public static void main (String[] args)
    

    Note that the m needs to be lower case