“Failed to load Main-Class manifest attribute …”,
Everything needed to run a jar file has been set, e.g. classpath, manifest file, etc. Yet after multiple checking and rechecking, you still unable to get the jar file run and, as a result, you get even more frustrated.
Take a look at the error message. What it says is that java.exe could not find the main class of our java application. The main class itself, as the entry point of a java application, is specified in file MANIFEST.MF.
So, you have to make sure that the main class is actually specified in the manifest file, i.e. the following line is available somewhere in your manifest file:
Main-Class: MyMainClass
Oh… in case you don’t notice… MyMainClass is actually your main class name, so replace it with the full name of your main class (the name of the class along with its package, if any)
There is one more fact you need to know about manifest file. You need to put a line break after the last line of the file. Fail to do so, the last line of the file won’t be parsed properly. So, in accordance with that, don’t forget to insert a line break to the line where the main class is specified, otherwise the error message will still pop up.
