Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2007

Tip: Looking for answers? Try searching our database.

About jar file

Thread view: 
Jack Dowson - 15 Sep 2007 05:04 GMT
Hello everybody:
I have a problem when I excuted a jar file.

My manifest.mf if as follow:
    Manifest-Version: 1.0
    Created-By: 1.5.0_02 (Sun Microsystems Inc.)
    Main-Class: WebBrowser
 (My programe can run when I use command "java WebBrowser")

When I used "jar cfm WebBrowser.jar MANIFEST.MF *.class" to create
WebBrowser.jar and then excuted it,my jvm poped out a message:
    "Failed to load Main-class manifest attribute form F:\java\Small
system\exploer\WebBrowser.jar"

I've set the right classpath,why?
Any help will be greatly appreciated!

Dowson
Andrew Thompson - 15 Sep 2007 05:29 GMT
...
> My manifest.mf if as follow:
>    Manifest-Version: 1.0
>    Created-By: 1.5.0_02 (Sun Microsystems Inc.)
>    Main-Class: WebBrowser

Does this file end in a blank line?  
It can cause problems if the manifest.mf does not
end with a single (entirely) blank line.

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Jack Dowson - 15 Sep 2007 06:59 GMT
Andrew Thompson 写道:
> Does this file end in a blank line?  
> It can cause problems if the manifest.mf does not
> end with a single (entirely) blank line.

Thank you so much!
It works when I add an entirely single blank line at the end.
Could you tell me why?

Dowson.
Andrew Thompson - 15 Sep 2007 07:16 GMT
>Andrew Thompson 写道:
>> Does this file end in a blank line?  
...
>It works when I add an entirely single blank line at the end.
>Could you tell me why?

Not very well.  

AFAIU, the tool that reads it, is designed to only
parse the information up to the 'next from last' line.  
Bug reports have been raised, but Sun marks them
as 'not a bug'.  I have never met any developer who
agrees with Sun's assessment.

Glad you got it sorted.

Oh, and before I forget.  Ant will typically generate
a valid manifest file.  I highly recommend doing the
build with the 'tool that gets it right', rather than
creating manifest files 'by hand' (making them in
a text editor).

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Jack Dowson - 15 Sep 2007 13:28 GMT
Andrew Thompson 写道:
> AFAIU, the tool that reads it, is designed to only
> parse the information up to the 'next from last' line.  
> Bug reports have been raised, but Sun marks them
> as 'not a bug'.  I have never met any developer who
> agrees with Sun's assessment.

Thank You!
Only to parse the information up to the 'next from last' line is really
a stupid design.

Dowson.
Mike Schilling - 15 Sep 2007 16:04 GMT
> Andrew Thompson ??:
>> AFAIU, the tool that reads it, is designed to only parse the information
[quoted text clipped - 5 lines]
> Only to parse the information up to the 'next from last' line is really a
> stupid design.

The manifest parser isn't quite that stupid.  It insists that every line be
terminated by a valid line terminator (LF/CRLF/CR).  If the last line isn't
terminated that way, it ignores it.  Since some editors don't terminate the
last line of a file that way, the safest thing to do is insert a blank line
at the bottom, guaranteeing that the previous (non-blank) line gets
terminated correctly.    Still not good behavior, I'll admit, but
kinda/sorta justified by the manifest spec at
http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Manifest-Overview.

At least Sun finally defined manifests as UTF-8.  The manifest-processing
code in java.util.jar used to silently throw away the high byte of every
character.
Andrew Thompson - 15 Sep 2007 16:16 GMT
>> Andrew Thompson ??:
>>> AFAIU, the tool that reads it, is designed to only ...
...
>> Only to parse the information up to the 'next from last' line is really a
>> stupid design.
>
>The manifest parser isn't quite that stupid.  
(snip..)

(phew)  I was just waiting for someone who actually knows
this stuff, to jump in.   ;-)

Signature

Andrew Thompson
http://www.athompson.info/andrew/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.