| Author |
java -jar HelloWorldApp.jar errors
|
|
| thufir 2004-12-28, 8:58 pm |
| 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 2004-12-28, 8:58 pm |
| 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
| |
| thufir 2004-12-28, 8:58 pm |
| 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 2004-12-28, 8:58 pm |
| 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
| |
| thufir 2004-12-28, 8:58 pm |
| 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...
| |
| ByteCoder 2004-12-28, 8:58 pm |
| 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
| |
| thufir 2004-12-28, 8:58 pm |
| 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 2004-12-28, 8:58 pm |
| 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
|
|
|
|