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 and runme.jar 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 " and runme.jar" Watch " and runme.jar" New topic
Author and runme.jar


Joined: Oct 28, 2005
Posts: 26
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 in the root direstory:
Manifest-Version: 1.0
Main-Class: suncertify.Start

I created the runme.jar using:
jar cvmf runme.jar -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 Wong<br />SCJP 1.4 & 5.0, SCJD, SCWCD, SCBCD, Oracle PL/SQL OCA
Gary Hellman

Joined: Sep 24, 2005
Posts: 11

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

see -

Hope this fixes it.
[ January 23, 2006: Message edited by: Gary Hellman ]

Thanks<br />Gary<br />SCJP 1.4
Surya De

Joined: Nov 06, 2005
Posts: 28
Quite useful, Gary thanks.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11776

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 -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 runme.jar -C suncertify .


jar cvfm runme.jar -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

The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog

Joined: Oct 28, 2005
Posts: 26
Thank you so much!!! I don't have a carriage return at the end of the line.
It works fine now.
I agree. Here's the link:
subject: and runme.jar
It's not a secret anymore!