I have been trying to create an excutable jar file. When trying to added new data to the manifest file it give me an error say 'invalid header field name: |||Manifest-Version:'. Iam using the command line:

jar -cfm App.jar META-INF\MANIFEST.MF mainui\*.class

the mainfest file looks like this

Manifest-Version: 1.0
Created-By: 1.4.2_13 (Sun Microsystems Inc.)
Main-Class: mainui.MainUI

It encoding is UTF-8. Can anyone see where im going wrong here.

Cheers

Declan.

Recommended Answers

All 4 Replies

I had problem with JAR sometime ago, bellow you find link to my original question and solution to it

LINK

Since your error message indicates garbage in front of "Manifest-Version", I assume your file contains garbage there.
Try recreating the manifest file from scratch, do as most people do and use ANT to make it for you ;)

Member Avatar for iamthwee

How do you use ANT to do it for you in netbeans?

Thanks Peter and J, I got it working by not trying to create the manifest file first and using the (M) command, but rather let the jar app create the default one with the cf command, then extract using the xf command, then edit the manifest file and re-create the jar usinf the cfm command, i think maybe the the format UTF-8 that is supplied in notepad is not completely what the jar file is looking for in a manifest file...

Thanks again :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.