File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes JAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JAR" Watch "JAR" New topic


Sam Bluesman
Ranch Hand

Joined: Nov 21, 2004
Posts: 191
I have 5 java classes that talk to each in a single directory called APRogram. I seem to be able to jar them. The command I used in Linux is:

jar cvf AProgram.jar mani.txt MainProgram.class Class1.class Class2.class Class3.class Class4.class

I have followed the instructions found on sun';s website but when i try and execute the jar file it says:

Failed to load Main-Class manifest attribute from

I did create a manifest (called mani.txt above) in the same directory that containd the lines:

Main-Class: AProgram
[carriage return]

Any ideas? Do I need to define some package or something at the top of each class file?

[ April 26, 2006: Message edited by: Sam Bluesman ]

Moosey knows best
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
The executable class is "MainProgram" I suppose, not "AProgram", so that needs to be in the manifest.
Sam Bluesman
Ranch Hand

Joined: Nov 21, 2004
Posts: 191
Thanks but I tired that and it still didnt work. Is there something I need ensure I have put into the actual classes themselves...??
Joanne Neal

Joined: Aug 05, 2005
Posts: 3742
Try including m in your options list

Usage: jar {ctxu}[vfm0Mi] [jar-file] [manifest-file] [-C dir] files ...
-m include manifest information from specified manifest file

I agree. Here's the link:
subject: JAR
It's not a secret anymore!