Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

HELP!<Failed to load Main-Class manifest attribute>

when i run :
java -jar aglets-2.0.2-src.jar

it gives me the error:
Failed to load Main-Class manifest attribute from
aglets-2.0.2-src.jar

How can i find out the entry point??
i.e what classname should i put in
Manifest-classname:<classname>

any help would be appreciated
Thanks
[334 byte] By [wizard] at [2007-11-9 22:30:50]
# 1 Re: HELP!<Failed to load Main-Class manifest attribute>
> when i run :
> java -jar aglets-2.0.2-src.jar
>
> it gives me the error:
> Failed to load Main-Class manifest attribute from
> aglets-2.0.2-src.jar

> How can i find out the entry point??
> i.e what classname should i put in
> Manifest-classname:<classname>
>

The class that you have to put there is the class that contains the
main function.
To figure out what class is it
You can do the following
1. Dearchive the JAR archive.
jar -xvf aglets-2.0.2-src.jar
2. Decompilate the .class files to .java files with JAD
jad -r -sjava -d . ./**/*.class
3. Find the file that contains "public static void main".
Under Linux use grep
grep --recursive 'public static void main' *
Under Windows use Start -> Search->For Files or Folders
4.Correct the file META-INF/manifest.mf with the classname of this
class including the package.
5. Archive the .class files again with JAR.

I hope this could be hapefull.
Jordan Dragoev Nedelchev at 2007-11-11 23:00:44 >
# 2 Re: HELP!<Failed to load Main-Class manifest attribute>
"Jordan Dragoev Nedelchev" <jorgo17bg@hotmail.com> wrote:
>
>> when i run :
>> java -jar aglets-2.0.2-src.jar
>>
>> it gives me the error:
>> Failed to load Main-Class manifest attribute from
>> aglets-2.0.2-src.jar
>
>> How can i find out the entry point??
>> i.e what classname should i put in
>> Manifest-classname:<classname>
>>
>
>The class that you have to put there is the class that contains the
>main function.
>To figure out what class is it
>You can do the following
>1. Dearchive the JAR archive.
> jar -xvf aglets-2.0.2-src.jar
>2. Decompilate the .class files to .java files with JAD
> jad -r -sjava -d . ./**/*.class
>3. Find the file that contains "public static void main".
> Under Linux use grep
> grep --recursive 'public static void main' *
> Under Windows use Start -> Search->For Files or Folders
>4.Correct the file META-INF/manifest.mf with the classname of this
> class including the package.
>5. Archive the .class files again with JAR.
>
>
>I hope this could be hapefull.
>
>
Contribution:
Beware that jad is not included in the java or java sdk distro. Besides that
jad is currently not freely available too, but I discovered that sureshot
cavaj (for mswin) is based on jad.exe. You can use this jad.exe on the command
line instead of cavaj.

Question:
What to do after you have just discovered that there is none 'public ...
main' at all in your jar?

I hope that this will be helpfull too
Jan Hoogma at 2007-11-11 23:01:39 >
# 3 Re: HELP!<Failed to load Main-Class manifest attribute>
> Question:
> What to do after you have just discovered that there is none 'public ...
> main' at all in your jar?
>
> I hope that this will be helpfull too

Answer:
So the JAR Archive is not executable, i.e. it does not contain a program.
Maybe it is a library or something like this.

Best Regards
Jordan Nedelchev jorgo17bg@hotmail.com
Jordan Dragoev Nedelchev at 2007-11-11 23:02:44 >
# 4 Re: HELP!<Failed to load Main-Class manifest attribute>
"Jordan Dragoev Nedelchev" <jorgo17bg@hotmail.com> wrote:
>> Question:
>> What to do after you have just discovered that there is none 'public ...
>> main' at all in your jar?
>>
>> I hope that this will be helpfull too
>
>Answer:
> So the JAR Archive is not executable, i.e. it does not contain a program.
> Maybe it is a library or something like this.
>
> Best Regards
> Jordan Nedelchev jorgo17bg@hotmail.com
>
>
It apperared to be a library and not a application with libraries as I thought.
(Luxor-Xul)

Thanks anyway,
Jan Hoogma
Jan Hoogma at 2007-11-11 23:03:44 >
# 5 Re: HELP!<Failed to load Main-Class manifest attribute>
To create a JAR file having a manifest with the appropriate Main-Class header,
you can use the Jar tool's m flag as described in the Modifying a Manifest
section. You would first prepare a text file consisting of single line with
the Main-Class header and value. For example, if your application was the
single-class HelloWorld application, the entry point would of course be the
HelloWorld class, and your text file would have this line:
Main-Class: HelloWorld
Assuming your text file was in a file called mainClass, you could merge it
into a JAR file's manifest with a command such as this:
Jay at 2007-11-11 23:04:43 >
# 6 Re: HELP!<Failed to load Main-Class manifest attribute>
"wizard" <java..@127.0.0.1> wrote:
>
>when i run :
>java -jar aglets-2.0.2-src.jar
>
>it gives me the error:
>Failed to load Main-Class manifest attribute from
>aglets-2.0.2-src.jar
>
>How can i find out the entry point??
>i.e what classname should i put in
>Manifest-classname:<classname>
>
>any help would be appreciated
>Thanks

It's because Sun developers are rock stupid and haven't been able to make
this procedure and easy one - for 7 years now. C# is waaaaaaay easier to
make a distribution!!

:))
javaman at 2007-11-11 23:05:43 >