• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to create jar with specified manifest.mf

 
Jianhua Ren
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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 manifest.mf 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?
Thanks,
Jianhua Ren
 
Terry Martinson
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
TJ
 
Mickael Haile
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
Mickael
 
Jianhua Ren
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 MyManifest.mf suncertify\server\*.class
No exception this time, but when I checed the manifest.mf 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 manifest.mf inside jar file still doesn't have Main-Class attribute. I just stuck with this.
Thanks again!
Jianhua
 
Jianhua Ren
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 manifiest.mf file system created. Thanks!
Jianhua
 
Dave Knipp
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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. http://ant.apache.org
Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic