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 / First Aid / December 2004

Tip: Looking for answers? Try searching our database.

java -jar HelloWorldApp.jar errors

Thread view: 
thufir - 28 Dec 2004 22:17 GMT
error:
C:\java>java -jar HelloWorldApp.jar
Failed to load Main-Class manifest attribute from HelloWorldApp.jar

contents:
C:\java>jar -tf HelloWorldApp.jar
META-INF/
META-INF/MANIFEST.MF
HelloWorldApp.class

creation:
C:\java>jar -cvf HelloWorldApp.jar HelloWorldApp.class
so..what's the error, pls?

thanks,

Thufir
ByteCoder - 28 Dec 2004 22:36 GMT
> error:
> C:\java>java -jar HelloWorldApp.jar
[quoted text clipped - 9 lines]
> C:\java>jar -cvf HelloWorldApp.jar HelloWorldApp.class
> so..what's the error, pls?

You forgot:
Main-Class: <class-name>

in the manifest file.

Signature

-------------
- ByteCoder -           ...I see stupid people
-------------
                   Curiosity *Skilled* the cat

thufir - 28 Dec 2004 22:44 GMT
thanks :)

I'll be looking on the web, but if i may:

where do I get the manifest?  how do I edit it?  where in the manifest
to I add that line?

thanks again,

Thufir
ByteCoder - 28 Dec 2004 22:50 GMT
> thanks :)
>
[quoted text clipped - 6 lines]
>
> Thufir

You can open/edit the jar file with any zip/archive program.
In the JAR file there should be a directory called /META-INF.
The manifest file itself is called manifest.mf
Just add a line "Main-Class: <name of class>".
The name of the class is relative to the root of the manifest file, so
if the Main-Class HelloWorld is in the package helloWorld the Main-Class
would be helloWorld.HelloWorld.

Signature

-------------
- ByteCoder -           ...I see stupid people
-------------
                   Curiosity *Skilled* the cat

thufir - 28 Dec 2004 23:15 GMT
from <http://java.sun.com/docs/books/tutorial/jar/basics/update.html>

jar -umf manifest.mf mainClass.txt

?? or

jar -umf mainClass.txt HelloWorldApp.jar

I'm not sure about this.  presumabely I need to specify mainClass.txt
(since it has the updated info) and mainifest.mf (since that's the file
to be updated) and the HelloWorldApp.jar (specifies which manifest.mf).
thinking outloud here...
ByteCoder - 28 Dec 2004 23:31 GMT
> from <http://java.sun.com/docs/books/tutorial/jar/basics/update.html>
>
[quoted text clipped - 8 lines]
> to be updated) and the HelloWorldApp.jar (specifies which manifest.mf).
> thinking outloud here...

Ok... you create a jar file. Please read the examples the jar file gives
you when you execute it without arguments, it can explain it better than
I can. Just don't forget to include you class files, which you don't do
in the above example.

Signature

-------------
- ByteCoder -           ...I see stupid people
-------------
                   Curiosity *Skilled* the cat

thufir - 28 Dec 2004 23:43 GMT
from winzip it shows two files:

HelloWorldApp.class
Manifest.mf

Manifest.mf has the path "meta-inf\"

I've tried several different ways of editing the manifest, but can't
get it.  all I manage to create is a second Manifest.mf without the
path...

from winzip, how do I edit this file, pls?

thanks,

Thufir
ByteCoder - 29 Dec 2004 00:24 GMT
> from winzip it shows two files:
>
[quoted text clipped - 8 lines]
>
> from winzip, how do I edit this file, pls?

From winzip? No idea. I use winrar and it works just fine. You could
extract the zip file, edit it and put it back together...

Signature

-------------
- ByteCoder -           ...I see stupid people
-------------
                   Curiosity *Skilled* the cat



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



©2008 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.