Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

java -jar HelloWorldApp.jar errors
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


Report this thread to moderator Post Follow-up to this message
Old Post
thufir
12-29-04 01:58 AM


Re: java -jar HelloWorldApp.jar errors
thufir wrote:
> 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?

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

in the manifest file.

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

Report this thread to moderator Post Follow-up to this message
Old Post
ByteCoder
12-29-04 01:58 AM


Re: java -jar HelloWorldApp.jar errors
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


Report this thread to moderator Post Follow-up to this message
Old Post
thufir
12-29-04 01:58 AM


Re: java -jar HelloWorldApp.jar errors
thufir wrote:
> 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

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.

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

Report this thread to moderator Post Follow-up to this message
Old Post
ByteCoder
12-29-04 01:58 AM


Re: java -jar HelloWorldApp.jar errors
from <http://java.sun.com/docs/books/tuto...ics/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...


Report this thread to moderator Post Follow-up to this message
Old Post
thufir
12-29-04 01:58 AM


Re: java -jar HelloWorldApp.jar errors
thufir wrote:
> from <http://java.sun.com/docs/books/tuto...ics/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...
>

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.

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

Report this thread to moderator Post Follow-up to this message
Old Post
ByteCoder
12-29-04 01:58 AM


Re: java -jar HelloWorldApp.jar errors
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


Report this thread to moderator Post Follow-up to this message
Old Post
thufir
12-29-04 01:58 AM


Re: java -jar HelloWorldApp.jar errors
thufir wrote:
> 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?

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

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

Report this thread to moderator Post Follow-up to this message
Old Post
ByteCoder
12-29-04 01:58 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 08:54 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.