Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I make a jar with Main-Class?

2 views
Skip to first unread message

Marie Henricsson

unread,
Apr 15, 2001, 3:44:16 AM4/15/01
to
Hi!

I want to create a jar file with a main-class.
(all files are in the same directory no packages, I use Java SDK 1.3)
I've made a textfile called manif.mft with only one line (to update the
Manifest.MF):
Main-Class: gui

I tried to create the jarfile with the command:
jar cfm manif.mft testa.jar gui.class kor.class LonePost.class
LoneBiPost.class LoneBiPostSum.class Postgam.class SkapaLon.class
SkapaLonebi2.class SkapaLonebibokning.class SkapaSlutPost.class
Textgam.class TotTxt.class TotTxt2.class

I got the following error message:

java.io.IOException: invalid header field
at java.util.jar.Attributes.read(Attributes.java:354)
at java.util.jar.Manifest.read(Manifest.java:161)
at java.util.jar.Manifest.<init>(Manifest.java:56)
at sun.tools.jar.Main.run(Main.java:125)
at sun.tools.jar.Main.main(Main.java:904)

I also tried to put the line: Manifest-Version: 1.0, in the manif.mft file
but the same error occured.

I have no problem to create a jar without using the manif.mtf file.

Can someone please help me with what information I need to include in the
manif.mtf file for this to work?

Thanks,
Marie

Richard Trahan

unread,
Apr 15, 2001, 4:23:42 AM4/15/01
to
Marie Henricsson wrote:
>
> Hi!
>
> I want to create a jar file with a main-class.
> (all files are in the same directory no packages, I use Java SDK 1.3)
> I've made a textfile called manif.mft with only one line (to update the
> Manifest.MF):
> Main-Class: gui
>
> I tried to create the jarfile with the command:
> jar cfm manif.mft testa.jar gui.class kor.class LonePost.class

You have the files reversed. The "fm" means the jar file name comes
first, then the manifest file name.

Nokomo

unread,
Apr 15, 2001, 4:24:39 AM4/15/01
to
Try this:
jar -cmf mainf.mft ...........

"Marie Henricsson" <Blood...@everyday.com> wrote in message
news:kjcC6.2741$Qp1....@nntp1.chello.se...

Marie Henricsson

unread,
Apr 15, 2001, 4:30:59 AM4/15/01
to
Hi, again!

Now I got rid of the error message, I created the jar first and updated it
with manif.mft. But the the MANIFEST.MF looks the same as before. No
Main-Class line included.

Thanks,

Marie

"Marie Henricsson" <Blood...@everyday.com> wrote in message
news:kjcC6.2741$Qp1....@nntp1.chello.se...

Marie Henricsson

unread,
Apr 15, 2001, 5:21:58 AM4/15/01
to
Hi, again!

Now it works.
Thank you.
/Marie

"Marie Henricsson" <Blood...@everyday.com> wrote in message

news:7%cC6.2750$Qp1....@nntp1.chello.se...

0 new messages