• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Failed to load Main-Class manifest attribute from classes.jar!!!

 
Mickael Haile
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,
my Name is Mickael .I am anew commer to this Groupe. Working with Max Habibi book for the developer exam, I want your HELP on Manifesting business.
C:\j2sdk1.4.0\DDVD2>dir
shows the source codes and the classes for the compiled .java codes like this:
27.10.2003 17:54 <DIR> .
27.10.2003 17:54 <DIR> ..
27.10.2003 17:23 <DIR> classes------compiled classes
27.10.2003 17:54 42.081 classes.jar
25.10.2003 17:32 10.226 DDVD.txt
25.10.2003 16:34 <DIR> dvd_db
27.10.2003 17:53 72 Manifest.MF
25.10.2003 12:28 <DIR> sampleproject-------the source codes
3 Datei(en) 52.449 Bytes
5 Verzeichnis(se), 1.154.252.800 Bytes frei
The ApllicationRunner.class is under:
\DDVD2\classes\sampleproject\gui\ApplicationRunner.class
The Manifest.MF contains:
Manifest-Version: 1.0
Main-Class: sampleproject.gui.ApplicationRunner
The classes.jar file is created with:
C:\j2sdk1.4.0\DDVD2>jar -cfm classes.jar Manifest.MF -C classes .
But when I try to run my classes.jar file the result is:
C:\j2sdk1.4.0\DDVD2>java -jar classes.jar
Failed to load Main-Class manifest attribute from
classes.jar
Can any body help me? I spent quit a lot time with it. It maybe a stupid question but what is the mistake I am doing here?
Thanks.
Mickael.
 
Bharat Ruparel
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mickael,
Your maifest file contains the following lines as you show above:

The Manifest.MF contains:
Manifest-Version: 1.0
Main-Class: sampleproject.gui.ApplicationRunner

Make sure that you have a carriage return at the end of the last line. That is, after the line
Main-Class: sampleproject.gui.ApplicationRunner<CR>
That should fix it.
Regards.
Bharat
 
Mickael Haile
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bharat,
Thanks for your quick Help. I was really very happy to see your reply. Unfortunately eventhough I did what you said I still got the same result: Failed to load Main-Class manifest attribute from
classes.jar
terrible isn�t it? But where do I get informations to this topic? and are there many mistakes in the Habibi book? Actually I love that book.
Thanks
Mickael.
 
Kerry Friesen
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mickael,
I've had this problem before and it was solved the way Bharat explained. Just make sure the last line in your manifest file is an empty one and it should work fine.
Cheers,
Kerry
 
Manoj Dixit
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mickael,
Make version 1.2 instead of 1.0.
Manoj,
 
Bharat Ruparel
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Manoj,
My Manifest.MF file has 1.0 instead of 1.2 and it works fine.
Mickael,
Will you please post exactly what are you typing in at the command line? Also what is your directory structure and from which directory are you executing your command?
To run the URLyBird Assignment, I enter the following command in the directory that contains my runme.jar file:
java -jar runme.jar alone
the alone is passed on to the ApplicationRunner's main method as a command line argument.
Does this give you any clues. The manifest file is very particular about its entries and does require the "Carriage Return". You are not literally typing <CR> by any chance are you? Just to clarify my own earlier post, <CR> means that you have to press the Enter key or Return key there. Most likely, that is what you are doing. I just want to be sure.
If things still don't work, please provide the details that I asked above and myself or other fellow ranchers will try to help you.
Regards.
Bharat
 
Mickael Haile
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bharat, Manoj and Kerry,
Thanks very much for your Help. I solved the Manifesting business!
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.
Thanks again for your Kindness and my REGARDS to everyone of YOU. Respect!
Mickael

 
Bharat Ruparel
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good job Mickael!
And welcome to JavaRanch.
Regards.
Bharat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic