• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

manifest.mf and runme.jar

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

My directory structure are the following (from root directory):
suncertify.db (all data classes)
suncertify.remote (all remote classes)
suncertify.gui (all client and server applications)
suncertify (contain a Start.class, the main program)

I created the manifest.mf in the root direstory:
Manifest-Version: 1.0
Main-Class: suncertify.Start

I created the runme.jar using:
jar cvmf runme.jar Manifest.mf -C suncertify .

When I try to run it:
java -jar runme.jar alone
I got an error "Failed to load Main-Class manifest attribute from runme.jar"

Can you help me figure what's wrong when I try to create executable jar? Thanks a lot!

Macy
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Macy,

Does your jar(oops - I mean manifest file) have a carriage control/line feed at the end?

see -
http://csdl.ics.hawaii.edu/~johnson/613f99/modules/04/jar-files.html

Hope this fixes it.
[ January 23, 2006: Message edited by: Gary Hellman ]
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Quite useful, Gary thanks.
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Macy,

While I think Gary's comment might provide the answer you need, I just wanted to check something.

I created the runme.jar using:
jar cvmf runme.jar Manifest.mf -C suncertify .

The options to creating a jar file are position dependant. That is, you have specified "cvmf" which means that you wish to create a jar file, be verbose about it (show on screen all files being added), the next command line parameter will be the manifest, followed by the jar filename.

However you then contradict this by listing the jar filename first then the manifest.

To fix that problem, the command line you should be using should be:

jar cvmf Manifest.mf runme.jar -C suncertify .

Or:

jar cvfm runme.jar Manifest.mf -C suncertify .

I also think your paths are going to be wrong inside the jar file. You specified "-C suncertify" on your command line, which means that the paths will all start from within the suncertify directory. That is, instead of your jar file containing "suncertify/Start.class" the suncertify will be dropped, and Start.class will appear in the root directory.

You can check this by running "jar tvf runme.jar" and check whether you have "suncertify" in the paths.

To get around that problem, just drop the "-C suncertify" from the command line.

Regards, Andrew
 
Macy
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much!!! I don't have a carriage return at the end of the line.
It works fine now.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic