0

I've successfully completed project and now create i need to create a jar file to submit it. I used Eclipse and MYSQL

In my src directory, I already created a folder META-MF with a MANIFEST.MF file that contains

Manifest-Version: 1.0
Main-Class: FrameLogin

After compiling and save my program, I exported the jar file using the existing manifest MANIFEST.MF from my workspace and imported the jar file in the lib folder

When I finally run it on command prompt it gives me and error

No main manifest attribute in jar

What am I missing here?

Additional question: When creating a manifest it says

It is important that the file ends with a blank line

What does it mean?

Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
xxx
  • 35
  • 5
  • *what does this thing mean?* exactly what is written: you should have an empty line at the end of the file. – Federico klez Culloca Feb 27 '21 at 11:28
  • About your main question, does `FrameLogin` belong to a package? Because in that case you should written the fully qualified name of the class, as in `com.mypackage.whatever.FrameLogin`. – Federico klez Culloca Feb 27 '21 at 11:29
  • does it count in the default package?, how do i write the fully qualified name of the class? could you explain me in details or send some reference ? – xxx Feb 27 '21 at 12:36
  • What do you mean "does it count in the default package"? About the fully qualified name, see my previous comment. The fully qualified name is the name of the package where the main class resides, then a dot, then the class name. – Federico klez Culloca Feb 27 '21 at 12:53
  • what I mean is that, my class is in the default package – xxx Feb 27 '21 at 13:03
  • Does that class have a `public static void main(String args[])` method? – Federico klez Culloca Feb 27 '21 at 13:13
  • yes it has, what should i do then? Do I just put the class name ,how? – xxx Feb 27 '21 at 13:29
  • 1
    Everything you wrote thus far points to the fact that all of this should work as it is. Last thing you can do is to check the content of the JAR itself and see if it contains the class and the manifest. – Federico klez Culloca Feb 27 '21 at 13:59

1 Answers1

1

According to the Manifest specification a newline (CR LF, LF or CR) is missing at the end of your MANIFEST.MF file.

Because of the missing newline, the last line containing the Main-Class attribute is ignored:

No main manifest attribute in jar

Or with other words,

It is important that the file ends with a blank line

howlger
  • 31,050
  • 11
  • 59
  • 99