Search code examples
javajarprogram-entry-point

How do I specify the entry point location in a Manifest-file to run a jar-file?


I am trying to run a program I've downloaded ( https://github.com/ottiram/MMAX2 ) which comes as a jar-file on Ubuntu 22.04. When I do, it returns: "no main manifest attribute, in MMAX2.jar". When I check in /META-INF/MANIFEST.MF, that file only contains one single line, namely:

"Manifest-Version: 1.0".

No entry point is specified. When I searched for the main method by looking for "public static void main", I found it in the file /org/eml/MMAX2/core/MMAX2.class in the class "MMAX2" (not sure if the file itself and this class it contains are equivalent?). I assume that I need to specify the location of this method in the Manifest-file!? I tried that several times with different ways of notation, e.g. by adding the following two lines to the Manifest:

"Main-Class: MMAX2.MMAX2.main

Class-Path: MMAX2.jar /org/eml/MMAX2/core/"

But then, when I try to run the jar, it returns: "Error: Could not find or load main class MMAX2.MMAX2.main Caused by: java.lang.ClassNotFoundException: MMAX2.MMAX2.main"

That also happened with other versions I've tried. I am not super techy, especially not when it comes to Java. Everything I've tried so far was the result of me copying code I've found as answer to similar questions. Maybe it's just a syntax-problem? Or my entire approach is wrong? Any help is very much appreciated!

Summary: I thought the problem was that the main-method can't be found from within the Manifest-file. So I tried to add the location of main-method to the Manifest-file, though I'm not sure if I've chosen the correct syntax.


Solution

  • I think it should be Main-Class: org.eml.MMAX2.core.MMAX2 instead.