File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Unable to create jar with specified Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Unable to create jar with specified" Watch "Unable to create jar with specified" New topic

Unable to create jar with specified

Jianhua Ren

Joined: Oct 19, 2003
Posts: 26
I'm trying to create a jar file, so that I don't need to mention codebase when I start the server. I created my own in one directory, and I specified Main-Class attribute inside that file, and then I typed jar cvfm server.jar manifest suncertify\server\*.class from that directory which contains my own manifest file, but I got the exception it says FileNotFound manifest. What's the matter here?
Jianhua Ren
Terry Martinson
Ranch Hand

Joined: Oct 18, 2003
Posts: 293
Hello Jianhua. Is manifest the full name of your manifest file, or is it something like manifest.MF? If it is manifest.MF, you need to put the full name in the jar command.
Here is how mine is set up - hope this helps.
My main project directory has both a classes subdirectory and a manifest.MF file.
The jar command I run from my main project directory is this:
jar -cfm runme.jar manifest.MF -C classes .
Good luck.

Mickael Haile

Joined: Oct 22, 2003
Posts: 6
Hello Jianhua,
We had a discussion on this topic on october.28.2003. It is still on this Site. Here is a copy of the solution of my case. But have a look at the whole discussion. It may help you solve your problem too.

Bahrat, yes at first I typed <CR> in the last line of the file. It didnot work instead the result was an Exception of not finding the class with<CR>.
Even changing the version into 1.2 did not helped me.
What I did is I just deleted every .jar and every .MF file and the inhalt of /dvd_db. Now I created everything new in this order:
first the .MF file with V1.0 and no <CR>.
then created the .jar file and
third using this .jar file I created the dvds for the dvd_db then everything was fine.
At last I could run the .jar file. I have no idea why things went wrong first, but I am happy to solve it now.
Good Luck!
Jianhua Ren

Joined: Oct 19, 2003
Posts: 26
Hi Terry,
Thank you for your reply!
I tried to give full name of manifest file when I created the jar file, the command I used is
jar cfm runme.jar suncertify\server\*.class
No exception this time, but when I checed the file under meta-inf dir inside the runme.jar, there is still no Main-Class attribute there.
This is really strange.
Hi Mickael,
Thank you for your reply!
I don't have <CR> in the end of last line of manifest file. And I also tried to delete any jar files and .mf files, then recreated them, still no luck, the inside jar file still doesn't have Main-Class attribute. I just stuck with this.
Thanks again!
Jianhua Ren

Joined: Oct 19, 2003
Posts: 26
Mickael, sorry for my missunderstanding to your previous email. I got the problem resolved by adding the <CR> in the end of last line of manifest file. And I can see the Main-Class attribute showed up in the file system created. Thanks!
Dave Knipp
Ranch Hand

Joined: Oct 14, 2003
Posts: 146
You should check out Ant. It lets you build jar's and specify mainfests really easily. And alot of ide's out there integrate with it so it makes development really fast.

SCJP 1.4, SCJD 1.4, SCWCD 1.3, SCBCD 1.3, IBM Certified Solution Developer -WebSphere Studio V5.0
I agree. Here's the link:
subject: Unable to create jar with specified
jQuery in Action, 3rd edition